CountDownTimer timer = new CountDownTimer(10000, 1000) { @Override public void onTick(long millisUntilFinished) { mLoginGetCodeBtn.setText(millisUntilFinished / 1000 + "s后再发送"); } @Override public void onFinish() { mLoginGetCodeBtn.setEnabled(true); mLoginGetCodeBtn.setText("发送验证码"); } };