gpt4 book ai didi

android - 如何获取当前的 InputMethodService

转载 作者:行者123 更新时间:2023-12-04 23:58:15 45 4
gpt4 key购买 nike

如何获取默认InputMethod的InputMethodService?

我已经试过了 this但我不知道如何通过 InputMethodInfo 获取 InputMethodService:

InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
List<InputMethodInfo> mInputMethodProperties = imm.getEnabledInputMethodList();

final int N = mInputMethodProperties.size();

for (int i = 0; i < N; i++) {

InputMethodInfo imi = mInputMethodProperties.get(i);

if (imi.getId().equals(Settings.Secure.getString(getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD))) {

//imi contains the information about the keyboard you are using
break;
}
}

还有其他我忽略的解决方案吗?

最佳答案

如果说“get”你的意思是获取它的 id,你想知道当前选择的(默认选择)的 id 是这样的:

    String currentKeyboard =  Settings.Secure.getString(getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD);

关于android - 如何获取当前的 InputMethodService,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25128932/

45 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com