Android 如何识别移动键盘处于活动状态?

Android 如何识别移动键盘处于活动状态?,android,keyboard,Android,Keyboard,我想在移动键盘处于活动状态时隐藏活动上的按钮。 我搜索并找到了这段代码,但不起作用 private boolean is_active_keyboard() { InputMethodManager imm = (InputMethodManager) this.getSystemService(Context.INPUT_METHOD_SERVICE); if (imm.isAcceptingText()) return true; else

我想在移动键盘处于活动状态时隐藏活动上的按钮。 我搜索并找到了这段代码,但不起作用

private boolean is_active_keyboard() {
    InputMethodManager imm = (InputMethodManager) this.getSystemService(Context.INPUT_METHOD_SERVICE);
    if (imm.isAcceptingText())
        return true;
    else
        return false;
}

只检查一次你能告诉我我的错误是什么吗?我的代码识别键盘是活动的还是不活动的。但我想知道当键盘激活时是什么?只检查一次你能告诉我我的错误是什么吗?我的代码识别键盘是活动的还是不活动的。但我想知道当键盘激活时是什么?