Search code examples
javaandroiduser-interfaceandroid-studioandroid-keypad

Is there a keypad widget for Android?


I'm working on a checkbook app, and I'd like to use a small widget like a TimePickerDialog or DatePickerDialog but one that acts like a keypad so the user can enter an account or transaction balance. I know I can use an EditText but I would like to be able to implement a keypad.

Does Android have any predefined UI elements to support this? I have tried to find some, but without luck. I did find an interesting article to implement my own using a GridLayout, but wondered if someone was aware of any Android classes that could already do this.

The GridLayout method: http://code.tutsplus.com/tutorials/android-user-interface-design-creating-a-numeric-keypad-with-gridlayout--mobile-8677


Solution

  • If you specify android:inputType="numberDecimal" in the XML for your EditText, you'll get a keypad. If you decide that you need a more specialized keyboard, there's a very good tutorial here.