在安装百度、搜狗输入法之后,会引导我们设置为当前的输入法,记下一下几个接口:
第一步:调出输入法设置界面
open.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { try { Intent intent = new Intent(); intent.setAction("android.intent.action.MAIN"); intent.setComponent(new ComponentName( "com.android.settings", "com.android.settings.LanguageSettings")); startActivityForResult(intent, 0); } catch (Exception e) { try { Intent intent2 = new Intent(); intent2.setAction("android.settings.INPUT_METHOD_SETTINGS"); startActivity(intent2); } catch (Exception ex) { Toast.makeText(Setting.this, "无法打开,请进入系统界面手动设置!", Toast.LENGTH_LONG).show(); ex.printStackTrace(); } e.printStackTrace(); } } });
第二步:调出输入法切换对话框
select.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { try { ((InputMethodManager) Setting.this.getApplicationContext() .getSystemService("input_method")) .showInputMethodPicker(); } catch (Exception e) { Toast.makeText(Setting.this, "无法打开,请进入系统界面手动设置!", Toast.LENGTH_LONG).show(); e.printStackTrace(); } } });