用户登录
用户注册

分享至

更改 Android 键盘语言

  • 作者: 我想静静啊啊
  • 来源: 51数据库
  • 2023-02-09

问题描述

如何更改 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.

软件
前端设计
程序设计
Java相关