//获取默认输入法包名:
private String getDefaultInputMethodPkgName(Context context) {
String mDefaultInputMethodPkg = null;
String mDefaultInputMethodCls = Settings.Secure.getString(
context.getContentResolver(),
Settings.Secure.DEFAULT_INPUT_METHOD);
//输入法类名信息
Log.d(TAG, "mDefaultInputMethodCls=" + mDefaultInputMethodCls);
if (!TextUtils.isEmpty(mDefaultInputMethodCls)) {
//输入法包名
mDefaultInputMethodPkg = mDefaultInputMethodCls.split("/")[0];
Log.d(TAG, "mDefaultInputMethodPkg=" + mDefaultInputMethodPkg);
}
return mDefaultInputMethodPkg;
}
public void getList(){
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
List<InputMethodInfo> methodList = imm.getInputMethodList();
for(InputMethodInfo mi : methodList ) {
CharSequence name = mi.loadLabel(getPackageManager());
Log.d(TAG, "getList: +"+name+ mi.getId());
}
}
https://bbs.youkuaiyun.com/topics/391815609?page=1
https://www.cnblogs.com/onelikeone/p/7582836.html