Android: How to make sliding buttons like phone unlock button on screensaver?
I don't know how exactly this type of buttons is called that's why I can't even google about it. You use that button to unlock phone - tap on it and move from left to right. I'd like to add same button in my app. How to do it?
You should use SeekBar to achieve what you want. http://developer.android.com/reference/android/widget/SeekBar.html
Here is a good example
http://www.techrepublic.com/blog/app-builder/androids-seekbar-your-way/943
You can overide onTouch() and change the location of the button acording to the x position. and when you lift the finger you can overide onUp() (im not sure thats the name of the method) and create an animation that will lead the button back to its place. From your question I get that you might think its a button you can simply add from a list of buttons, well, its not. you need to manualy create it.
试试这个一库https://github.com/sitepoint-editors/SwipeButtonExample这对于一个DIY https://rightclicksolutions.wordpress.com/2014/04/09/android-slide-to-unlock-like-ios -MB滑块滑块/
链接地址: http://www.djcxy.com/p/65242.html上一篇: PHP在路径中包含一个变量