Show English keyboard for EditText (Android)

In my android app, I have used EditText to take text input from the user. I want the EditText to only accept selective characters, for that in the xml file I mentioned the following property for the EditText.

android:digits="@string/customDigits"

      

and customDigits are mentioned in strings.xml

<string name="customDigits">\u0022;\u005C;&amp;&lt;&gt;&#92; abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!#$%\'()*+,-./:;=?@[]_`{};|~^"*"</string>

      

I have given multilingual support to my android app. When I select languages ​​like FRENCH, GERMAN, SPANISH and EditText, it shows the correct English keyboard as shown: -

enter image description here

But when I select JAPANESE language and EditText is in focus, then it shows Japan keyboard as shown: -

enter image description here

But I want to show the default English keyboard. Please provide me with a solution.

+3


source to share


2 answers


You may try

input.setRawInputType(Configuration.KEYBOARD_QWERTY);

      



But from a UX perspective, I would say that nothing needs to be "fixed" here. If the user decides they want Japanese, they become Japanese. You are expecting certain characters, but this has nothing to do with the custom language settings and the type of keyboard it uses. It's not really your interest - just reject his entry if it fails and make sure the error message (or UI) clearly indicates that you expect ASCII (or whatever) to be entered in this EditText.

0


source


It may be too late, I am facing the same problem as you.

I have a imeOptions="flagForceAscii

solution imeOptions="flagForceAscii

and a keyboard displaying latin characters as first priority.



Hope this can help somehow. forceAscii

0


source







All Articles