以编程方式更改android设备的输入法

时间:2023-03-06
本文介绍了以编程方式更改android设备的输入法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 android 中开发一个小型应用程序,其中包括一个编辑文本和按钮.按钮仅在编辑文本不为空白后可见.因为我有 LG Optimums Android 设备,每当我点击编辑文本,因为它是 LG 设备,LG 键盘会出现,但我不想要那个键盘我想要 Android要使用的键盘.我也知道我可以进入设置=>语言&键盘&我可以改变那个键盘.但我不想使用我希望它只能通过编码来完成.

I am developing one small application in android which consist of an Edit Text & Button. Button will be visible only after edit text is not blank.Since I am having LG Optimums Android device, Whenever i click on Edit Text since it it LG device, LG Key Board will appear but i don't want that Key Board i want Android Key Board to use. I Also know that i can go into Setting=>Language & Key Board & i can change that Key Board. But i don't want to use that i want it should be done only through coding.

感谢任何帮助.....

Thanx for any Help.....

推荐答案

无法以编程方式更改用户的键盘设置.您唯一能做的就是建议用户更改它并帮助它这样做.例如,这将显示一个对话框供他们更改键盘:

It's not possible to change the keyboard settings for the user programmatically. The only thing you can do is advise the user to change it and help it to do so. For instance, this will show a dialog for them to change keyboard:

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();
        }
    }

这篇关于以编程方式更改android设备的输入法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

上一篇:在模态视图控制器中调用 becomeFirstResponder 时的键 下一篇:动态获取键盘边框

相关文章

最新文章