如何同时使用android中的SeekBar作为seekBar和progressBar?
我打算为我的应用程序编写一个自定义媒体控制器。我计划使用搜索栏来搜索和显示进度。正在努力实现这一点。
有人有这样的实施还是我走错了路?
I intend to write a custom media controller for my app. I was planning to use seekbar to do both seeking and showing progress. Trying to implement this.
Does anyone have such implementation or am I on the wrong path ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
终于我想通了!!
我想出的解决方案是这样的:
首先将搜索栏的最大进度设置为视频的持续时间
此可运行程序将继续更新进度栏:
然后可以使用搜索栏的 setOnSeekBarChangeListener 来获取用户在媒体上寻求。通过使用 fromUser 布尔值,我们可以判断这是由于用户交互还是由于
Finally I figured it out!!
The solution that I came up with was something like this :
First of all set the max progress for seekbar as the duration of the video
This runnable will keep on updating the progressbar :
And then the setOnSeekBarChangeListener for the seekbar can be used to take the user seeks on the media. By using the fromUser boolean we can make out whether it was a call back due to user's interaction or the
您设置辅助进度。
不,你走在正确的道路上。它非常适合显示下载进度和流(媒体)的当前位置等内容。
You set the seconday progress.
No, you're on the right track. It is very good for displaying stuff like download progress and current location for streams (media).