标签:安卓 倒计时
安卓实现倒计时,下面的例子是10秒的倒计时
public class PowerOff extends Activity { TextView textView; CountDownTimer timer; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.power_off); textView = (TextView) findViewById(R.id.time); timer = new CountDownTimer(10 * 1000, 1000) { @Override public void onTick(long millisUntilFinished) { textView.setText(millisUntilFinished / 1000 + "秒后关机"); } @Override public void onFinish() { textView.setText("正在关机..."); } }.start(); } }
标签:安卓 倒计时
原文地址:http://luoguoxin.blog.51cto.com/8845916/1606125