all=(RelativeLayout)findViewById(R.id.all);
all.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
// TODO 自动生成的方法存根
all.setFocusable(true);
all.setFocusableInTouchMode(true);
all.requestFocus();
InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
return false;
}
});
Android单击界面上面的其他位置,取消焦点,让键盘消失
最新推荐文章于 2023-02-16 16:25:33 发布