enter image description here

I needed to make a vertical switch , I don’t find anything on the Internet, at least I didn’t find it, there are options with ToggleButton and ImageButton , but this doesn’t suit me very much, because switching only when pressed, the implementation via OnTouchListener also not very suitable.

In general, can there be a library with which you can implement a vertical switch ?

  • If it were small, I would not bother, and since it will be large, they will obviously be included with a swipe. - Vladimir VSeos
  • These are just two pictures in the selector (the position is on and the position is off), you can draw anything there, even a diagonal switch. See for example this checkbox answer - the principle is the same. - pavlofff
  • In this embodiment, svayp will not work. At the moment I have implemented it using the ImageButton. - Vladimir VSeos
  • But the Switch already reacts to the swipe (it can be moved with a finger), what makes you think that this will not work? Although in your case you still need to redefine the onTouch() method so that it reacts to vertical, not horizontal svayp (specifically, the TOUCH_MODE_DRAGGING case and onDraw() logic, yet to customize the switch itself) . There is probably no ready solution, you need to make your own class - pavlofff
  • @pavlofff, Thank you, yes, there is no ready-made solution, I will try as you recommend. - Vladimir VSeos

0