如何自动显示外国键盘,而不是默认的英文键盘类型面板上? [英] How to automatically display a foreign keyboard instead of default English keyboard on the type panel?

查看:156
本文介绍了如何自动显示外国键盘,而不是默认的英文键盘类型面板上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做英语以外的语言一个问题和答案的游戏。这些问题将在尼泊尔(类似于印度人)和用户需要键入在同一脚本的答案。当我运行英文键盘被显示的应用程序,我已经输入之前切换到尼泊尔键盘。不过反正是有,当用户点击入式面板,它会自动显示尼泊尔键盘代替英语(英语键盘是主要的键盘在每个电话)?

I'm making a questions and answers game in a language other than English. The questions will be in Nepali (similar to indian) and user needs to type answers in the same script. When I run the app the English keyboard gets displayed and I've to switch to the Nepali keyboard before typing. But is there anyway that when user taps into the type panel, it automatically displays a Nepali Keyboard instead of English (as English Keyboard is the primary keyboard in every phone)?

一旦在网络上搜索,我发现这样的事情:

Upon searching on the net I found something like this:

private void showInputMethodPicker() {
    InputMethodManager imeManager = (InputMethodManager) getApplicationContext().getSystemService(INPUT_METHOD_SERVICE); 
    if (imeManager != null) {
        imeManager.showInputMethodPicker();
    } else {
        Toast.makeText(this, R.string.not_possible_im_picker, Toast.LENGTH_LONG).show();
    }
}

但我不知道它做什么。请帮助!

But I'm not sure what it does. Please Help!

推荐答案

您可以做,在你想在不同的语言键盘的活动。如果您有想有另一种语言键盘的许多活动。

You can do, in your Activity that you want to have the keyboard in different language. If you have many activities that you want to have keyboards in another language.

    Resources res = context.getResources();
    DisplayMetrics dm = res.getDisplayMetrics();
    android.content.res.Configuration conf = res.getConfiguration();
    conf.locale = new Locale(language_code.toLowerCase());
    res.updateConfiguration(conf, dm);

这篇关于如何自动显示外国键盘,而不是默认的英文键盘类型面板上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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