一段时间后关闭进度条
我创建了一个进度条,我需要在单击播放特定声音的按钮时显示该进度条。现在我希望计时器显示在进度条下方,并希望进度条和计时器随着声音的长度同时运行。
另外,当声音完成时,我希望 PregressBar 和 Timer 再次不可见,以便我可以为另一个声音再次启动它。
有人可以帮我吗?
谢谢, 大卫
I have created a progress Bar which I need to show on clicking the Button that plays the particular sound. Now I want the timer to be displayed below the ProgressBar and want both the ProgressBar and Timer to run Simultaneously along with the length of the sound.
Also when the sound gets finished, I want the PregressBar and Timer to be invisible again so that I can start it again for the another Sound.
Can anybody please help me in this?
Thanks,
david
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
此处使用
AsyncTask
类在
onPreExecute
上启动计时器和 ProgressBar在
doInBackground
中播放特定声音并在完成时返回因此,在
onPostExecute
中,您可以使 PregressBar 和 Timer 停止且不可见点击侦听器上的按钮,您可以开始执行 AsyncTask.
execute
Use
AsyncTask
class herestart the timer and ProgressBar on
onPreExecute
Play the particular sound inside
doInBackground
and return when it is finishedSo in
onPostExecute
you can make that PregressBar and Timer stop and invisibleAnd Button on click listener you can start its execution AsyncTask.
execute