在Android的天文台表倒计时 [英] Chronometer countdown in android

查看:150
本文介绍了在Android的天文台表倒计时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经实现从Android API演示一个简单的计时表。现在是有可能显示天文台表倒计时起步一样设置为01:23的onClick然后启动按钮,它将改变为01:22,然后01:21等等......直到00:00。请让我知道如果有人以前做过。
<一href=\"http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/ChronometerDemo.html\" rel=\"nofollow\">http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/ChronometerDemo.html

I have implemented a simple chronometer from the android api demo. Now is it possible to show the countdown in chronometer like setting the start to 01:23 then onClick of start button, it will change to 01:22 then 01:21 and so on... till 00:00. Please let me know if anyone did it before. http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/ChronometerDemo.html

感谢您。

推荐答案

对于那些谁感兴趣的话,就来看看的 CountDownTimer 类。

For those who are interested, take a look at CountDownTimer class.

例如:

new CountDownTimer(30000, 1000) {

 public void onTick(long millisUntilFinished) {
     mTextField.setText("seconds remaining: " + millisUntilFinished / 1000);
 }

 public void onFinish() {
     mTextField.setText("done!");
 }
}.start();

这篇关于在Android的天文台表倒计时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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