Android: How to make sliding buttons, such as a phone unlock button on a screensaver?

I don’t know exactly what this type of button is called, so I can’t even talk about it. You use this button to unlock the phone - tap it and drag it from left to right. I would like to add the same button to my application. How to do it?

enter image description here

+7
source share
3 answers
+4
source

You can override onTouch () and reposition the button according to the x position. and when you lift your finger, you can override onUp () (im not sure thats name the method) and create an animation that will return the button to its place. From your question, I realized that you can think of your button, which you can simply add from the list of buttons, well, it doesn’t. you need to manually create it.

0
source

All Articles