After obtaining the SMS verification code, the button background changes and the countdown occurs. The SMS Verification Code

Source: Internet
Author: User

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>

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.