多语言Android应用程序:在“电子邮件"和“密码栏位 [英] Multilingual Android app: Display English keyboard in Email & Password fields

查看:82
本文介绍了多语言Android应用程序:在“电子邮件"和“密码栏位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在开发一个多语言的Android应用程序,同时针对英语和英语;阿拉伯.登录和登录中面临的问题是注册屏幕,我们希望用户名和密码字段仅以英文文本&因此,无论设备的语言环境是什么语言,都显示英语键盘

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

尝试在edittext中设置inputtype ="email",但是,此操作无法按预期进行.

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.

感谢&问候, 吉加尔(Jigar J)

Thanks & regards, Jigar J

推荐答案

最终得到了解决方案.

用例:无论用户在应用(本地)或电话(系统区域设置)中设置的当前区域设置如何,都强制用户以英语"输入输入内容.

Usecase : Enforcing user to enter input in ‘English’ regardless of current Locale set in App(Local) or Phone (System Locale)

解决方案: 我们具有名为"imeOptions"的EditText控件的属性,该属性允许限制用户输入特定输入类型"的文本.

Solution : We have the property of EditText control called ‘imeOptions’ which allows to restrict user to enter text of specific ‘input type’.

为了限制用户输入英语"文本,我们只需要使用"flagForceAscii"属性.

In order to restrict user to enter ‘english’ text we only need to use ‘flagForceAscii’ property.

用法: 通过xml:

android:imeOptions="flagForceAscii"

通过Java:

editText.setImeOptions(EditorInfo.IME_FLAG_FORCE_ASCII);


版本兼容性:

此属性在API16(又名豆形软糖)中添加了

This attribute was adden in API16, aka Jellybean

这篇关于多语言Android应用程序:在“电子邮件"和“密码栏位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆