Android 更改键盘输入语言
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12303593/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Change Keyboard input language
提问by Chetan Bhalara
I am developing one android app in two different languages. When user click on "Change language" button it ask to choose language from two different languages option and change keyboard according to that language.
我正在用两种不同的语言开发一个 android 应用程序。当用户单击“更改语言”按钮时,它会要求从两种不同的语言选项中选择语言并根据该语言更改键盘。
For example : User choose "Arabic" language then keyboard input language should automatically change from English to Arabic.
例如:用户选择“阿拉伯语”语言,然后键盘输入语言应自动从英语更改为阿拉伯语。
Please help me to resolve this issue.
请帮我解决这个问题。
回答by D Yao.
This isn't really that possible. You can change the users locale using a number of solutions present on stackoverflow already:
这真的不太可能。您可以使用 stackoverflow 上已有的许多解决方案更改用户区域设置:
Here for example, or here for another.
However, this will only change the locale. The problem you will encounter is that the keyboard is itself an application. Therefore, you cannot change it directly from your app, nor can you guarantee that your user will have the "Arabic" charset or addon or whatever, for they keyboard app that they employ.
但是,这只会更改语言环境。你会遇到的问题是键盘本身就是一个应用程序。因此,您不能直接从您的应用程序更改它,也不能保证您的用户将拥有他们使用的键盘应用程序的“阿拉伯”字符集或插件或其他任何内容。
Your only real and reliable solution if you wish to accomplish what you need would be to create your own keyboard input. Otherwise, it will be in the user's hands to change their keyboard to Arabic.
如果您希望完成所需的工作,唯一真正可靠的解决方案是创建自己的键盘输入。否则,将在用户手中将他们的键盘更改为阿拉伯语。