Android seekbar with marks at discrete progress points

限于喜欢 提交于 2019-12-07 03:28:57

问题


I want to have a seekbar(like int the link: YUI Library Examples) with marks at discrete progress points, but the progress interval is not static. How can I achieve this?


回答1:


You can code up a custom View that draws the vertical lines at whatever points you want.

See: http://developer.android.com/guide/topics/ui/custom-components.html

You'll just need to override onDraw(Canvas canvas) to draw your lines. You can use proportions of the width of the view as your markers. Each vertical line would be at the point

lineNumber * (viewWidth) / numLines

from lineNumber = 0 to lineNumber = numLines-1

Your progress would be drawn in a similar manner, but yeah.. you've gotta do this yourself.



来源:https://stackoverflow.com/questions/11648477/android-seekbar-with-marks-at-discrete-progress-points

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!