Reputation: 31
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.
Upvotes: 2
Views: 1991
Reputation: 23655
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.
Upvotes: 0
Reputation: 38065
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).
Upvotes: 1
Reputation: 34554
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.
Upvotes: 0