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

方法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);
    		}
    	}


你可能感兴趣的:(android 隐藏输入键盘的两种方法)