如题!先谢了!

解决方案 »

  1.   

    小弟想过0.5秒就检测一次虚拟键盘的状态,用下面这个方法
    private boolean CheckKeyBoard()
            {
                     InputMethodManager m = (InputMethodManager)
             CenterText.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);   
                     return m.isActive();
            }
    为什么每次都是返回true,我把虚拟键盘按下去后还是返回true,为什么呀? 
      

  2.   

    写一个onKeyDown函数就可以了,在eclipse中直接写onKeyDown然后按Alt + ? 就会出现继承的onKeyDown这样,你就可以捕捉键值了
      

  3.   

        /**
         * Return true if any view is currently active in the input method.
         */
        public boolean isActive() {
            checkFocus();
            synchronized (mH) {
                return mServedView != null && mCurrentTextBoxAttribute != null;
            }
        }这是InputMethodManager, isActive方法的源码,从注释就可以观察到,这不是用来判断是否虚拟键盘中是否有键按下。
      

  4.   

    可以去看下这篇文章http://www.iteye.com/topic/601094