android 隐藏输入键盘的两种方法

来源:互联网 发布:csi单片机如何写入程序 编辑:程序博客网 时间:2024/04/27 17:28

方法1:

InputMethodManager imm =(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);imm.hideSoftInputFromWindow(editText1.getWindowToken(), 0);

方法2:

I

InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);    if(imm.isActive()){    if(getCurrentFocus()!=null){    imm.hideSoftInputFromWindow(getCurrentFocus().getApplicationWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);    }    }


0 0
原创粉丝点击