倒计时功能如上图所示,其实就几行代码即可实现效果啦!!!
1 /** 倒计时60秒,一次1秒 */ 2 CountDownTimer timer = new CountDownTimer(60*1000, 1000) { 3 @Override 4 public void onTick(long millisUntilFinished) { 5 // TODO Auto-generated method stub 6 textView_time_shengxu.setText("还剩"+millisUntilFinished/1000+"秒"); 7 } 8 9 @Override 10 public void onFinish() { 11 textView_time_shengxu.setText("时间已到,请重新获取验证码!!!"); 12 } 13 }.start();