Search code examples
androidtouch-event

Custom Button Android that increases percentage on touch event


I need to achieve this UI in Android. When sliding right, it increases the percentage and the blue view increases in both ways, and when sliding left it decreases it, both view and percentage in TextView. Any ideas I can do that? Thanks

enter image description here


Solution

  • I used the library that has almost the same design that you need. If it's not convenient for you can check implementation and create your own custom view. Basically you would need to track touch events in OnTouchListener and draw on Canvas with coordinates that you got from OnTouch.