A PIN entry view widget for Android with support for Android 5 Material Theme features via the AppCompat v7 support library.
Uses a hidden
EditText to handle input, hence behaves much in the same was as an
EditText on the screen and supports similar features.
- 1.0.2 - Add support for elevation on the digits in Lollipop
- 1.0.1 - Minor fixes
- 1.0.0 - Initial release
Add the following to your
numDigits- The number of digits in the PIN, default 4.
digitWidth- The width of the digit view, default 50dp.
digitHeight- The heigh of the digit view, default 50dp.
digitSpacing- The distance between the digit views, default 20dp.
digitBackground- A resource to use for the digit views, supports drawables or colours and can be used with a custom selector as an alternative to using the built in accent support (by setting the
accentColoras transparent). Defaults to
android:windowBackgroundfrom the current theme.
digitTextSize- The size of the text in the digit view, default 15sp.
digitTextColor- The colour of the text in the digit view, defaults to
android:textColorPrimaryfrom the current theme.
digitElevation- Set the elevation of the digit views, API 21+ only, default 0dp.
mask- A character to use as a mask for the entered PIN value, can be set to an empty string to show typed numbers, default *.
accentColor- The colour of the accent to use to highlight the view when it's in focus, defaults to
android:colorAccentfrom the current theme.
accentWidth- The width of the accent highlight, default 3dp.
accentType- Defines the behaviour of the accent, default none, options:
all- highlights each separate digit view
character- highlights a single digit view to represent the position of the cursor
Copyright 2014 Phil Bayfield Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.