星空网 > 软件开发 > 操作系统

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

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();  }

 

login_edit_normal_bg.

<??><shape ="http://schemas.android.com/apk/res/android"  android:shape="rectangle"  android:useLevel="false">  <!-- 背景填充颜色值 -->  <solid android:color="#6c948b" />  <!-- radius值越大,越趋于圆形 -->  <corners android:radius="10dip" />  <!-- 圆角图像内部填充四周的大小 ,将会以此挤压内部布置的view -->  <padding    android:bottom="10dip"    android:left="5dip"    android:right="10dip"    android:top="10dip" /></shape>

login_edit_passed_bg.

<??><shape ="http://schemas.android.com/apk/res/android"  android:shape="rectangle"  android:useLevel="false">  <!-- 背景填充颜色值 -->  <solid android:color="#509989" />  <!-- radius值越大,越趋于圆形 -->  <corners android:radius="10dip" />  <!-- 圆角图像内部填充四周的大小 ,将会以此挤压内部布置的view -->  <padding    android:bottom="10dip"    android:left="5dip"    android:right="10dip"    android:top="10dip" /></shape>

 




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

关键词:

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

美国贸易战略:https://www.goluckyvip.com/tag/12565.html
人民日报头版:https://www.goluckyvip.com/tag/12566.html
跨境电试验区:https://www.goluckyvip.com/tag/12567.html
视频编辑软件:https://www.goluckyvip.com/tag/12568.html
航班影响:https://www.goluckyvip.com/tag/1257.html
全球物流排行:https://www.goluckyvip.com/tag/12570.html
深圳玉龙公园簕杜鹃花海花期时间+门票+交通:https://www.vstour.cn/a/365174.html
出境旅游预订须知:https://www.vstour.cn/a/365175.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流