Search code examples
androidvalidationandroid-layoutandroid-xml

Can I make Android hide the "N", "Wait" and "Pause" keys from the keyboard when adding a phone number?


When adding a phone number field I wrote the following XML:

    <EditText
        android:id="@+id/etPhoneNumber"
        style="@style/my_edit_text"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="10dp"
        android:hint="@string/cdu_phone_number_hint"
        android:inputType="phone"
        android:autofillHints="phone"
        android:digits="+0123456789"
        android:textColor="@color/black"
        android:visibility="visible" />

However, even though I specified digits, Android still displays those buttons for "wait", "pause" etc. Is there any way to NOT display those?

Keyboard with wait, pause etc


Solution

  • THe keyboard is a separate app that gets to decide for itself what keys to show. The only control you have over it is the inputType, which serves as a hint to the keyboard for what you want. Apparently whatever keyboard you're using wants to show those keys too. You can't stop it. You could try changing the input type to number and see if you prefer that. But remember it will show up differently on different devices no matter what you do, because they'll use different keyboard apps (there is no single keyboard that's on every device, just some that are more common than others- and the user can always decide to install their own too).