InputMethodManager imm= (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
@Override
public boolean onTouchEvent(MotionEvent event) {
// TODO Auto-generated method stub
if (event.getAction() == MotionEvent.ACTION_DOWN) { if (myActivity.this.getCurrentFocus() != null) {
if (myActivity.this.getCurrentFocus().getWindowToken() != null) {
imm.hideSoftInputFromWindow(myActivity.this.getCurrentFocus().getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS);
}
}
}
return super.onTouchEvent(event);
}
Android 点击EditText的时候弹出软键盘,点击EditText之外空白处软键盘消失
最新推荐文章于 2021-05-27 05:50:19 发布