imm.isActive()一直返回true

来源:互联网 发布:java final void 编辑:程序博客网 时间:2024/04/30 03:58
 InputMethodManager imm = (InputMethodManager) mActivity.getSystemService(Context.INPUT_METHOD_SERVICE);                boolean isOpen = imm.isActive(mActivity.etComment);

  isActive()还有个带参数的方法isActive(View view),把你的EditText的view对象传进去就OK了。

百度了一下没找到解决方法,还是看一下源码的解释。

/** * Return true if the given view is the currently active view for the * input method. */public boolean isActive(View view) {    checkFocus();    synchronized (mH) {        return (mServedView == view                || (mServedView != null                        && mServedView.checkInputConnectionProxy(view)))                && mCurrentTextBoxAttribute != null;    }}/** * Return true if any view is currently active in the input method. */public boolean isActive() {    checkFocus();    synchronized (mH) {        return mServedView != null && mCurrentTextBoxAttribute != null;    }}

0 0
原创粉丝点击