从字符串 02:00 分钟 Android 获取倒计时
我有一个 textView,其值为 2:00,表示还剩 2 分 00 秒。
我有一个可以计时的秒表功能。我已将它们整合起来以进行向上工作。
我想做的是,每一秒都会显示出来
1:59
1:58
1:57
,依此类推,直到到达 0:00。
我需要的帮助是将文本视图文本重新格式化为时间,而不是每秒钟 - 1
在 C# 中,我可能会使用 2:00.addseconds(-1) 2:00 表示重新格式化的文本视图。
I have a textView that has the value 2:00 that is representing 2 minutes and 00 seconds to go.
I have a stopwatch function that will count up. I have integrated them to work upwars.
What I'm trying to do is to for every seconds that pass I will show
1:59
1:58
1:57
and so on until reaching 0:00.
The help I need is to reformat the textview text to time and than for every go seconds - 1
In C# I would probably use 2:00.addseconds(-1) 2:00 is representing the reformatted textview.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为你可以使用这样的指令来获取开始时间:
然后你可以创建另一个变量,你将检查到 while 循环,例如:
这应该有效,如果有问题请告诉我
i think you can use an instruction like this to get the start time:
then you can create another variable which you will check into a while loop, for example:
this should work, let me know if you have problems
在某处以 int 形式跟踪时间。
在你的调度程序/定时器
然后在你的文本写入循环中
Keep track of time as an int somewhere.
At your scheduler/timer
Then in your text-writing loop
嗨,谢谢
Int mSecond 代码确实很好地完成了代码,
我现在遇到的问题是
倒计时为 13 秒。如果我从 0:00 开始算一数,我就会进入递减计数器
2:13 于 2:00
你可以说它们不同步:(
我需要将刷新率设置为 1000 毫秒
我想这是因为它每隔一段时间就会错过一秒钟
因为刷新率高。
原始刷新率设置为 100 毫秒。
我尝试了一些设置,但不起作用,
我正在使用 StopWatch 类来计算经过的时间。
Hi thanx
The Int mSecond code did the code real good
the problem i now get is that the
countdown is 13 sec of. If i start at 0:00 and count that one up i get on the downcounter
2:13 at 2:00
you can say that they are not in sync :(
I need to set the Refresh rate att 1000 millisec
I think it is because it miss a second every once in a while
because of the high refreshrate.
Orginal was set to a refresh rate at 100 millisec.
i´ve tryied a couple of settings but non work
i´m Using StopWatch class to count the timeelapsed.