鉴于以下代码:
InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
List<InputMethodInfo> inputMethods = imm.getEnabledInputMethodList();
for(InputMethodInfo method : inputMethods){
String name = method.loadLabel(activity.getPackageManager()).toString();
new InfoDialog(activity,name).show();
//imm.setInputMethod(token, id);
}我的设备上安装了两种输入法:、三星键盘、和,谷歌手写输入。我想要做的是在这两个键盘之间切换,使用setInputMethod。
示例:
imm.setInputMethod(<Samsung Keyboard>);或
imm.setInputMethod(<Google Handwriting Input>);怎么做?知道吗?
发布于 2016-06-22 04:51:10
不可能被动地更改它,而是提示用户这样做。
InputMethodManager imeManager = (InputMethodManager) getApplicationContext().getSystemService(INPUT_METHOD_SERVICE);
imeManager.showInputMethodPicker();但是,如果您拥有系统特权,则可以将其更改如下:
Settings.Secure.putString(resolver, Settings.Secure.ENABLED_INPUT_METHODS, "com.package.to.keyboard/.full.path");
Settings.Secure.putString(resolver, Settings.Secure.DEFAULT_INPUT_METHOD, "com.package.to.keyboard/.full.path");https://stackoverflow.com/questions/37958223
复制相似问题