/** * 点击空白区域隐藏键盘. */ @Override public boolean onTouchEvent(MotionEvent event) { InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); if (event.getAction() == MotionEvent.ACTION_DOWN) { if (LoginActivity.this.getCurrentFocus() != null) { if (LoginActivity.this.getCurrentFocus().getWindowToken() != null) { imm.hideSoftInputFromWindow(LoginActivity.this.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } } } return super.onTouchEvent(event); }
点击 空白处 键盘进行隐藏
最新推荐文章于 2024-08-08 04:21:32 发布