在离散进度点带有标记的 Android 搜索栏 [英] Android seekbar with marks at discrete progress points

查看:35
本文介绍了在离散进度点带有标记的 Android 搜索栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要一个搜索栏(比如链接:YUI Library示例) 在离散的进度点处带有标记,但进度间隔不是静态的.我怎样才能做到这一点?

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?

推荐答案

您可以编写自定义 View 代码,在您想要的任何点绘制垂直线.

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

参见:http://developer.android.com/guide/主题/ui/custom-components.html

您只需要覆盖 onDraw(Canvas canvas) 即可绘制线条.您可以使用视图宽度的比例作为标记.每条垂直线都在点

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

lineNumber * (viewWidth) / numLines

从 lineNumber = 0 到 lineNumber = numLines-1

from lineNumber = 0 to lineNumber = numLines-1

您的进度将以类似的方式绘制,但是是的..您必须自己做.

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

这篇关于在离散进度点带有标记的 Android 搜索栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆