我必须在 android 中获取当前选择的键盘语言。到目前为止,我正在使用这个:
InputMethodManager imm = (InputMethodManager)getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
InputMethodSubtype ims = imm.getCurrentInputMethodSubtype();
if(ims != null)
{
String lName = ims.getLocale();
Locale locale = new Locale(lName);
String lang = locale.getLanguage();
}
但三星键盘和 Swiftkey 键盘总是返回设备的语言,而不是选择的键盘语言。在 Swiftkey 上,当设备的语言与英语不同时,它会为所有语言返回类似的内容:
“it_it”、“ru_ru”、“bg_bg”
如何正确获取当前的键盘语言?