In a number of Android projects I've worked on we've had a requirement for a PIN code entry screen, something which is sadly lacking from the Android SDK. I started working on this a while ago but when the requirement came up again recently it prompted me to give it a quick Android 5 revamp and publish it on Github and Maven Central.
Here is a demo of the current version:
There are a number of ways that this kind of widget can be created, ranging from a complex custom editable view to a number of separate
EditText views with a mass of event listeners. I went for something somewhere in the middle - A custom
ViewGroup that uses an "invisible"
EditText to delegate input to.
This is a surprisingly simple and effective way to create a view that has all the features of an
EditText but looks completely different. Provided the
EditText is visible and of at least 1px in size it can receive focus, then with a single
TextWatcher the user input can be displayed however you want.
Details and updates to this project can be found on my Projects page.