We are working on a multilingual Android app, targeting both English & Arabic. An issue being faced is in the Login & Registration screens, where we want the username and password fields to be entered only in English text & thus display the English keyboard, irrespective of the device locale language
Have tried setting the inputtype="email" in edittext but, this didn't work as desired.
Can someone please point out if there are any possibilities.
Thanks & regards, Jigar J
Finally got the solution.
Usecase : Enforcing user to enter input in ‘English’ regardless of current Locale set in App(Local) or Phone (System Locale)
Solution :
We have the property of EditText
control called ‘imeOptions’ which allows to restrict user to enter text of specific ‘input type’.
In order to restrict user to enter ‘english’ text we only need to use ‘flagForceAscii’ property.
Usage: Via xml :
android:imeOptions="flagForceAscii"
Via java:
editText.setImeOptions(EditorInfo.IME_FLAG_FORCE_ASCII);
Version Compatibility :
This attribute was adden in API16, aka Jellybean
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