【发布时间】:2020-07-02 16:53:04
【问题描述】:
嗨,我是新来的,我需要知道如何检测在 android webview 中打开了哪种键盘类型,这是我的尝试
KeyboardUtils.addKeyboardToggleListener(this, new KeyboardUtils.SoftKeyboardToggleListener()
{
@Override
public void onToggleSoftKeyboard(boolean isVisible)
{
if(isVisible){
InputMethodManager imm =(InputMethodManager)MainActivity.this.getSystemService(Context.INPUT_METHOD_SERVICE);
Log.d(TAG, "onToggleSoftKeyboard: "+imm.getCurrentInputMethodSubtype().getMode());
//
}
Log.d("keyboard", "keyboard visible: "+isVisible);
}
});
【问题讨论】:
-
结果如何?
-
我得到了这个日志onToggleSoftKeyboard: keyboard
标签: android webview android-softkeyboard