简体   繁体   English

Android:如何在屏幕保护程序上制作滑动按钮(如手机解锁按钮)?

[英]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. 我不知道这种按钮的确切名称,这就是为什么我什至无法在Google上找到它的原因。 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 can overide onTouch() and change the location of the button acording to the x position. 您可以覆盖onTouch()并根据x位置更改按钮的位置。 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. 当您抬起手指时,您可以覆盖onUp()(不确定方法的名称)并创建动画,该动画将导致按钮返回其位置。 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. 您需要手动创建它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM