(三十)点击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();
			}
		}
	}

  

posted @ 2014-12-24 10:59  小菜美妞成长中  阅读(301)  评论(0编辑  收藏  举报