Android edittext Box Verification Code SMS Verification Code Introduction

Source: Internet
Author: User
Tags delete key

This article is provided by Xiawe_i.

Xiawe_i's blog address is:

Http://www.jianshu.com/u/fa9f03a240c6

The project has such a requirement:

Verification code page is four boxes, enter the Verification code box color change, delete and change back to the original color.

First look at the effect, the motion diagram is not very clear, will see it

Ideas:

    1. Overlap with four textview with a transparent edittext and set the default background for TextView

    2. Listen for edittext text changes, get input, assign TextView and change TextView background

    3. 4 TextView have value after adding input completion callback, listen Delete key add Delete callback

First look at the layout as follows:

You can see overlapping with four textview with a transparent edittext, and set the default background for TextView.

Next look at the View code:

The code for the listener is:

Use the above section as a standalone view module.

Use:

The first must be the declaration layout file:

The code used is:

Demo Address:

Https://github.com/xiaviv/SecurityCodeDemo

Android edittext Box Verification Code SMS Verification Code Introduction

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.