Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android seekbar with marks at discrete progress points

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?

like image 321
iargin Avatar asked Jul 25 '12 11:07

iargin


1 Answers

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.

like image 118
Christopher Perry Avatar answered Oct 04 '22 02:10

Christopher Perry