Android custom password input box and numeric keypad

A user-defined password input box and a user-defined numeric keyboard are implemented as the user payment password setting interface. First, the effect drawing is as follows, square style, and click the blank space to hide the soft keyboard.

Control implementation list: 1) input box control integrated into EditText: passwordinputview. Java 2) numeric keyboard tool class: numkeyboardutil. Java 3) XML file: number. XML 4) attrs style 5) layout file

Specific contents:

PasswordInputView.java

Numkeyboardutil numeric soft keyboard tool class

Number.xml note that this file needs to be placed in the XML directory under the res directory of the project (if not, create one)

Styles in attrs.xml:

Layout code:

Activity code snippet:

PS: if you use this password input box and other types of input boxes together, you should pay attention to hiding the system soft keyboard and custom numeric keyboard when the focus changes. My approach is to bind the onfauschangelistener event to the password input box to control it. As follows:

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

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
分享
二维码
< <上一篇
下一篇>>