简体   繁体   中英

Implementing a slide bar like iOS in Android

Here I have this image.

两个木偶

I want to implement a slide button or slide bar or anything that similar to this in Android. How can I do this, Is there any library for this? . Thanks so much.

Take a look on this library: Swipe List View use it for ideas. Check SwipeListViewTouchListener's method

public boolean onTouch(View view, MotionEvent motionEvent)

Or also, take a look at this answer: how to swipe a button ontouch event in android

Edit:

Perhaps, if you don't need the library, use a FrameLayout and add the TextView ("Slide to Unlock") as first child, and the button as the second child. Then, implement the OnTouchListener of the button, and animate it's moviment to the right. Lot's of answers as to "how to move a view using OnTouchListener". Here's an example android: move a view on touch move (ACTION_MOVE)

SeekBar应该是一个很好的扩展类,尽管您必须实现所有动画内容,并且显然必须实现所有GFX定制: http : //developer.android.com/reference/android/widget/SeekBar.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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