CountDownTimer实现倒计时

private TimeCount time;

time=newTimeCount(60000,1000); 

private classTimeCountextendsCountDownTimer {

publicTimeCount(longmillisInFuture,longcountDownInterval) {

super(millisInFuture, countDownInterval);

//TODO Auto-generated constructor stub

}

@Override

public voidonTick(longmillisUntilFinished) {

//TODO Auto-generated method stub

tv_huoquyanzheng.setClickable(false);// 防止重复点击

tv_huoquyanzheng.setTextColor(0xFF444444);

tv_huoquyanzheng

.setText(millisUntilFinished /1000+"s"+"后再次发送");

}

@Override

public voidonFinish() {

tv_huoquyanzheng.setText("获取验证码");

tv_huoquyanzheng.setTextColor(0xFFac0000);

tv_huoquyanzheng.setClickable(true);

}

}

你可能感兴趣的:(CountDownTimer实现倒计时)