android点击空白处隐藏键盘(亲测)

只需在空白的LinearLayout添加点击事件即可,

点击事件的内容:

/*
   	 * 处理键盘
   	 */
   	private void dealwithHiddenInputKeyBoard() {


   		InputMethodManager inputManager = (InputMethodManager) BookSearchActivity.this
   				.getSystemService(Context.INPUT_METHOD_SERVICE);


   		// check if no view has focus:
   		View view = BookSearchActivity.this.getCurrentFocus();
   		if (view != null) {
   			inputManager.hideSoftInputFromWindow(view.getWindowToken(),
   					InputMethodManager.HIDE_NOT_ALWAYS);
   		}
   	}
亲测成功。

你可能感兴趣的:(Android事件)