更新时间:2023-01-24 15:33:18
下面是我所做获得可用的输入语言:
Here's what I did to get the available input languages:
private void printInputLanguages() {
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
List<InputMethodInfo> ims = imm.getEnabledInputMethodList();
for (InputMethodInfo method : ims){
List<InputMethodSubtype> submethods = imm.getEnabledInputMethodSubtypeList(method, true);
for (InputMethodSubtype submethod : submethods){
if (submethod.getMode().equals("keyboard")){
String currentLocale = submethod.getLocale();
Log.i(TAG, "Available input method locale: " + currentLocale);
}
}
}
}