Change Input method of android device programatically android(以编程方式更改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设备的输入法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:以编程方式更改android设备的输入法
基础教程推荐
- 突出显示朗读文本(在 iPhone 的故事书类型应用程序中) 2022-01-01
- 如何将多个组件添加到 PickerView? 2022-01-01
- 新的@SystemApi 注解是什么意思,和@hide 有什么区别 2022-01-01
- Android:STATE_SELECTED不工作 2022-01-01
- 在 iOS8 中无法获得正确的键盘高度值 2022-01-01
- 我的 UIImageView 的任务 2022-01-01
- 在 appComponent dagger 2 中动态添加测试模块? 2022-01-01
- 可可/目标C(OSX不是iOS)从子对象访问父对象 2022-01-01
- 在 Android 模拟器中激活网络位置提供程序? 2022-01-01
- - (CGRect)convertRect:(CGRect)rect toView:(UIView *)view 如何工作 2022-01-01
