就是在使用tabactivity时某个tab(activity)中有两个view,第一个view1里面有个edittext,第一次可以显示软键盘,跳到第二个view2时再切换到view1,那个edittext点击就不弹出软件盘,怎么回事儿???

解决方案 »

  1.   

    唉还是得靠自己啊。。解决了帖出来。。分享下下。。
    这个是tabactivity中使用多个view切换就会出现的现象,在其它activity中是没有问题的。不过刚才已经解决了。
    onFocusChange(View v, boolean hasFocus){if(v==searchBoxEditText){if(hasFocus==true){
    ((InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE))
        .showSoftInput(myEditText, InputMethodManager.SHOW_FORCED);}else{ //ie searchBoxEditText doesn't have focus
    ((InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE))
        .hideSoftInputFromWindow(myEditText.getWindowToken(), 0);}
    }
    }//end onFocusChange
    给edittext添加focus事件,每次从其它view再次返回到有edittext页面时,clearfocus就哦了。
    哦了。
      

  2.   

    onFocusChange(View v, boolean hasFocus){if(v==searchBoxEditText){if(hasFocus==true){
    ((InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE))
      .showSoftInput(myEditText, InputMethodManager.SHOW_FORCED);}else{ //ie searchBoxEditText doesn't have focus
    ((InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE))
      .hideSoftInputFromWindow(myEditText.getWindowToken(), 0);}
    }
    }//end onFocusChange
    这个方法确实是正确的哦