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:
Overlap with four textview with a transparent edittext and set the default background for TextView
Listen for edittext text changes, get input, assign TextView and change TextView background
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