Implementation of payment password input box in Android

Let's take a look at the renderings first

Implementation idea:

The controls that become points are not textview and EditText, but ImageView. First, write a relativelayout, which contains six imageviews and an EditText (the EditText should overwrite the ImageView), and set the background of the EditText to be transparent.

Customize a control itempasswordlayout to handle the layout. The key point is to remove the cursor of EditText and listen for the events of entering text. After the text changes, put the text in a StringBuffer and set EditText to ""; Then listen for the event of pressing the delete key on the keyboard. When the delete key is pressed, the characters at the corresponding position will be deleted from the StringBuffer.

Next, you only need to call in the activity.

Declare in XML

Call in Activity

summary

Well, that's the end of this article. That's it. Isn't it very simple. I hope this article can bring some help to your study or work. If you have any questions, you can leave a message.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>