更改 Android 键盘语言

Change Android KeyBoard language(更改 Android 键盘语言)
本文介绍了更改 Android 键盘语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

如何更改 Android 键盘语言?

How to change Android Keyboard language?

我设置了以下代码来设置语言.我从设置中设置了不同的语言并尝试设置英语.

I have set below code to set language. I set different language from Settings and trying to set English language.

Locale.setDefault(Locale.ENGLISH);
Configuration config = getResources().getConfiguration();
config.locale = Locale.ENGLISH;
getBaseContext().getResources().updateConfiguration(config, null);

推荐答案

更改 locale 只会将 resources(例如,字符串、图像等)更改为为应用程序中的特定 locale.要更改keyboard支持的语言,您必须确保设备上安装了正确的输入法(因为输入法本身也是一个app,所以会换成对应的语言).

Changing locale only changes the resources (e.g., strings, images, etc) to those defined for a specific locale in an app. To change the language supported by the keyboard, you have to make sure a proper input method is installed on the device (because the input method itself is also an app, it will change to a corresponding language).

例如Nexus S上只有英文键盘,如果我需要支持其他语言的键盘,我需要找到输入法 支持该语言,然后安装它.

For example, there is only English keyboard on Nexus S, if I need a keyboard that supports other language, I need to find a input method that supports that language, and install it.

为了确保用户有一个,您可以发出一些警报以引起用户的注意,或者通过 ACTION_XXX_SETTINGS 意图将他们带到键盘设置活动.

To make sure the user have one, you can make some alert to take the users' attention, or bring them to the keyboard settings activity by ACTION_XXX_SETTINGS intent.

这篇关于更改 Android 键盘语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Android release APK crash with java.lang.AssertionError: impossible in java.lang.Enum(Android 发布 APK 因 java.lang.AssertionError 崩溃:在 java.lang.Enum 中不可能)
Finished with Non Zero Exit Value 3(以非零退出值 3 结束)
On gradle:3.0.0 More than one file was found with OS independent path #39;META-INF/ASL2.0#39;(在 gradle:3.0.0 上找到多个文件,其独立于操作系统的路径为“META-INF/ASL2.0)
Android : app loading library at runtime on Lollipop but not IceCreamSandwich(Android:运行时在 Lollipop 上而不是 IceCreamSandwich 上的应用程序加载库)
buildConfigField depending on flavor + buildType(buildConfigField 取决于风味 + buildType)
How do I suppress warnings when compiling an android library with gradle?(使用 gradle 编译 android 库时如何抑制警告?)