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) {