设计自定义SeekBar时的指示器
我想设计一个与此完全相同的 SeekBar
。在图中,您可以看到 SeekBar
停在不同的位置。我已经这样做了,但我无法在“SeekBar”的背景中显示与所有设备兼容的指示器。
I want to design a SeekBar
exactly like that. In the picture you can see the SeekBar
stops on different positions. I have done that but I am not able to show indicators in the background of `SeekBar which will be compatible for all the devices.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
采取文本视图。
将其放置在您希望在 xml 中放置指示器的位置。
假设您希望根据seekbar的25个进度在指示器中显示进度。
我只是举一个例子来说明你可以用它做什么。你按照要求做就可以了。
Take a text view.
Place it where you like to place the indicator in xml.
Suppose according to the 25 progress of seekbar you like to show the progress in the indicator.
I just give an example that what you can do with it. You do according to the requirement.
我建议你采用 TextView。然后在 onProgressChanged(SeekBar arg0, intprogress, boolean arg2) 方法中,您将获得搜索栏的进度。根据进度在文本视图中显示指示符文本。我就是这样做的。你可以尝试一下。
I would suggest you to take a TextView. Then in onProgressChanged(SeekBar arg0, int progress, boolean arg2) method you will get the progress of the seekbar. Show the indicator text in the textview according to the progress. I have did it in this way. You can try it.