I have an App which requires the input of a sequence of space-separated hex digit groups (much like a product key) into an EditText, such as AB34 67EF ...
The problem is that every time a numeric digit is entered followed by space, the Android keyboard automatically switches back to alphabetic mode, which is both confusing and highly annoying to the user.
For example, when typing the two groups above, the keyboard will remain in numerics mode when '3' is pressed, but then switches to letters mode when the space key is hit after '4' - meaning the user then has to manually switch back to numerics before entering '6'.
The EditText control (below) has textNoSuggestions flag set for the input type, but no matter what inputType and what keyboard settings I change, I cannot get the keyboard to stay in numerics mode following a space.
<EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView1"
android:layout_below="@+id/textView1"
android:inputType="textCapCharacters|textNoSuggestions"
android:ems="10" >
<requestFocus />
</EditText>
Is there any way to force the keyboard to stay in the current mode after a space character is entered or, alternatively, a way to programatically switch the keyboard mode?
The android:inputType attribute allows you to specify various behaviors for the input method. Most importantly, if your text field is intended for basic text input (such as for a text message), you should enable auto spelling correction with the "textAutoCorrect" value.
I needed the same. The inputType textVisiblePassword
did the trick for me.
Reference: InputType
<EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView1"
android:layout_below="@+id/textView1"
android:inputType="textVisiblePassword|textCapCharacters"
android:ems="10" >
<requestFocus />
</EditText>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With