开发者

horizontal bar slider

I am looking for a class that implement 开发者_高级运维a horizontal slider bar like the one on the "lock" screen. In other words, user must slide the bar from left to right to run an activity. Thank you so much for your time.


Internally, Android uses a class called SlidingTab for this (the main lockscreen is in a file called LockScreen.java. As with all Android core code, it's Apache licensed. At the risk of sounding like a broken record here on SO, download the AOSP and read through the code whenever you have a "how did the Google folks do x?" type of question (or even when you don't; there's some good stuff in there).


Maybe a Seek Bar might help you towards a solution to your problem. If this works for you let me know, because i am interested in a solution to that as well. Thanks

The link is the developer document for that feature.


Here is an example that extends a horizontal ProgressBar so that the user can set the "progress" by sliding left/right. It's actually quite straight forward, it just overrides the onTouchEvent() method, does some minor mathematics and sets the progress value depending on the TouchEvent's X coordinate.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜