首页 > 代码库 > (二十九)点击EditText关闭系统软键盘

(二十九)点击EditText关闭系统软键盘

/**	 * 关闭系统软键盘	 */	private void closeKeyboard(EditText et) {		// TODO Auto-generated method stub		if (android.os.Build.VERSION.SDK_INT <= 10) {			tv.setInputType(InputType.TYPE_NULL);		} else {			getWindow().setSoftInputMode(					WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);			try {				Class<EditText> cls = EditText.class;				Method setShowSoftInputOnFocus;				setShowSoftInputOnFocus = cls.getMethod(						"setShowSoftInputOnFocus", boolean.class);				setShowSoftInputOnFocus.setAccessible(true);				setShowSoftInputOnFocus.invoke(et, false);			} catch (Exception e) {				e.printStackTrace();			}		}	}

  

(二十九)点击EditText关闭系统软键盘