After obtaining the SMS verification code, the button background changes and the countdown occurs. The SMS Verification Code
Private Button getVerCodeButton; // initialize getVerCodeButton = (Button) findViewById (R. id. login_get_ver_code);/*** display the time in the text box */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 + "get again in seconds"); getVerCodeButton. setClickable (false); getVerCodeButton. setBackgroundResource (R. drawable. login_get_ver_code_ag_bg) ;}}); if (time <= 1) {result = false; getVerCodeButton. post (new Runnable () {@ Override public void run () {getVerCodeButton. setTextSize (10); getVerCodeButton. setText ("re-obtain Verification Code"); getVerCodeButton. setClickable (true); getVerCodeButton. setBackgroundResource (R. drawable. login_get_ver_code_before_bg );}});}}}}). start ();}
Login_edit_normal_bg.xml:
<? Xml version = "1.0" encoding = "UTF-8"?> <Shape xmlns: android = "http://schemas.android.com/apk/res/android" android: shape = "rectangle" android: useLevel = "false"> <! -- Background fill color value --> <solid android: color = "# 6c948b"/> <! -- The larger the radius value, the more circular it is --> <corners android: radius = "10dip"/> <! -- Fill the rounded corner image with the surrounding size to squeeze the view layout. --> <padding android: bottom = "10dip" android: left = "5dip" android: right = "10dip" android: top = "10dip"/> </shape>
Login_edit_passed_bg.xml:
<? Xml version = "1.0" encoding = "UTF-8"?> <Shape xmlns: android = "http://schemas.android.com/apk/res/android" android: shape = "rectangle" android: useLevel = "false"> <! -- Background fill color value --> <solid android: color = "#509989"/> <! -- The larger the radius value, the more circular it is --> <corners android: radius = "10dip"/> <! -- Fill the rounded corner image with the surrounding size to squeeze the view layout. --> <padding android: bottom = "10dip" android: left = "5dip" android: right = "10dip" android: top = "10dip"/> </shape>