/*验证码倒计时*/
private class TimeCount extends CountDownTimer{
/**
* @param millisInFuture 总时间长度(毫秒)
* @param countDownInterval 时间间隔(毫秒),每经过一次时间间隔都会调用onTick方法
*/
public TimeCount(long millisInFuture, long countDownInterval) {
super(millisInFuture, countDownInterval);
}
@Override
public void onTick(long millisUntilFinished) { //倒计时状态
getVerificationCodeBtn.setClickable(false); //设置button此时不可点击
getVerificationCodeBtn.setBackground(getResources().getDrawable(R.drawable.get_verification_code_waitting_bg));//修改button的背景
getVerificationCodeBtn.setTextColor(getResources().getColor(R.color.black));//修改button的textColor
getVerificationCodeBtn.setText(millisUntilFinished / 1000 +"s后可重新发送");//显示button的倒计时文字
}
@Override
public void onFinish() { //倒计时结束状态
getVerificationCodeBtn.setBackground(getResources().getDrawable(R.drawable.login_btn_bg));
getVerificationCodeBtn.setTextColor(getResources().getColor(R.color.white));
getVerificationCodeBtn.setClickable(true); //重新设置button为可点击
getVerificationCodeBtn.setText("重新获取"); //修改button的文字
}
}
TimeCount timeCount = new TimeCount(60000,1000); timeCount.start();
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有