Multilingual Android app: Display English keyboard in Email & Password fields

偶尔善良 提交于 2019-12-06 11:27:06
Jigar Joshi

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!