androidandroid-studioandroid-layoutkeyboardandroid-keypad

Using numeric keyboard on EditText in android studio


I'm using an EditText in my android app, and I want a numeric keyboard to show when I tap and try to edit it.


Solution

  • There are two easy ways to do it, add one of the following to EditText block in XML file:

    1. To get a Numeric dial keyboard pad
            android:inputType="phone"
            android:digits="1234567890"
    
    1. To get the Numeric section of keyboard
            android:inputType="number"