天天看點

activity 下 點選空白處隐藏鍵盤

public boolean onTouchEvent(MotionEvent event) {

if (null !=this.getCurrentFocus()) {

InputMethodManager mInputMethodManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);

return mInputMethodManager.hideSoftInputFromWindow(this

.getCurrentFocus().getWindowToken(), 0);

}

return super.onTouchEvent(event);

}