Android InputTypes and Keyboards
When reading input from an Android user with an EditText, you have a simple way to help that user out by setting the InputType. If you need the user to input a number, for example, you set the number InputType, and the user will automatically key a numeric keypad instead of the full QWERTY. This saves the user a little bit of time and mental energy, and helps avoid mistakes with input.
Beyond just text and numbers, though, are a range of options that produce very subtle changes in the keyboard that Android brings up. Below I explore which options bring up which keypad by default.
First, the standard keyboard, which covers a lot of the input types.
TYPE_CLASS_TEXT
TYPE_TEXT_VARIATION_EMAIL_SUBJECT
TYPE_TEXT_VARIATION_LONG_MESSAGE
TYPE_TEXT_VARIATION_PERSON_NAME
TYPE_TEXT_VARIATION_POSTAL_ADDRESS
TYPE_TEXT_VARIATION_PASSWORD
TYPE_TEXT_VARIATION_VISIBLE_PASSWORD
TYPE_TEXT_VARIATION_WEB_EDIT_TEXT
TYPE_TEXT_VARIATION_FILTER
TYPE_TEXT_VARIATION_PHONETIC
TYPE_TEXT_VARIATION_WEB_PASSWORD
For our first subtle variation, the URI keyboard replaces the comma with a slash.
TYPE_TEXT_VARIATION_URI
TYPE_TEXT_VARIATION_URI
Next, the email keyboard replaces the comma with an @.
TYPE_TEXT_VARIATION_EMAIL_ADDRESS
TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS
TYPE_TEXT_VARIATION_EMAIL_ADDRESS
TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS
The short message keyboard replaces the enter key with emoji access.
TYPE_TEXT_VARIATION_SHORT_MESSAGE
TYPE_TEXT_VARIATION_SHORT_MESSAGE
The other main keyboard is for numeric entry.
TYPE_CLASS_NUMBER
TYPE_NUMBER_FLAG_DECIMAL
TYPE_NUMBER_FLAG_SIGNED
TYPE_CLASS_NUMBER
TYPE_NUMBER_FLAG_DECIMAL
TYPE_NUMBER_FLAG_SIGNED
The number password variant reduces the available symbols and focuses just on the numbers.
TYPE_NUMBER_VARIATION_PASSWORD
The phone class adds some symbols common for phone number formatting, plus star & hash.
TYPE_CLASS_PHONE