我自己在ancivity中写了个搜索的东西,可是在点击过button之后输入法还没关闭,想咨询一下能不能在button的click事件中关闭掉输入法,如何实现,谢谢

解决方案 »

  1.   

    试试这个
    xml    android:editable="false" 
      

  2.   

    是在button属性里面写吗?这样不行
      

  3.   

    ((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE))
    .hideSoftInputFromWindow(getCurrentFocus()
    .getWindowToken(),
    InputMethodManager.HIDE_NOT_ALWAYS);
    这个就可以了,可是得点两下
      

  4.   

        关闭软键盘的代码:
        InputMethodManager imm = (InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);     
     
            imm.hideSoftInputFromWindow(editText.getWindowToken(), 0);