你的位置:首页 > 软件开发 > 操作系统 > 获取短信验证码之后按钮背景变化并且出现倒计时

获取短信验证码之后按钮背景变化并且出现倒计时

发布时间:2016-01-08 16:00:08
private Button getVerCodeButton;//初始化getVerCodeButton = (Button) findViewById(R.id.login_get_ver_code);/** * 显示时间在梯减的文本框 */ public void ...
private Button getVerCodeButton;//初始化getVerCodeButton = (Button) findViewById(R.id.login_get_ver_code);/**   * 显示时间在梯减的文本框   */  public void showTime() {    new Thread(new Runnable() {      boolean result = true;      int time = 30;      @Override      public void run() {        while (result) {          time--;          SystemClock.sleep(1000);          getVerCodeButton.post(new Runnable() {            @Override            public void run() {              getVerCodeButton.setTextSize(11);              getVerCodeButton.setText(time + "秒后重新获取");              getVerCodeButton.setClickable(false);              getVerCodeButton.setBackgroundResource(R.drawable.login_get_ver_code_ago_bg);            }          });          if (time <= 1) {            result = false;            getVerCodeButton.post(new Runnable() {              @Override              public void run() {                getVerCodeButton.setTextSize(10);                getVerCodeButton.setText("重新获取验证码");                getVerCodeButton.setClickable(true);                getVerCodeButton.setBackgroundResource(R.drawable.login_get_ver_code_before_bg);              }            });          }        }      }    }).start();  }

原标题:获取短信验证码之后按钮背景变化并且出现倒计时

关键词:

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

可能感兴趣文章

我的浏览记录