首先获得软键盘的对象InputMethodManager imm= (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
然后注册空白处的touch事件if (event.getAction() == MotionEvent.ACTION_DOWN) {
System.out.println("down");
if (RegisterActivity.this.getCurrentFocus() != null) {
if (RegisterActivity.this.getCurrentFocus().getWindowToken() != null) {
imm.hideSoftInputFromWindow(RegisterActivity.this.getCurrentFocus().getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS);
}
}
}

841

被折叠的 条评论
为什么被折叠?



