当我们点击EditText的时候会默认弹出系统的软键盘,当点击其他控件的时候,默认是不会关闭其他系统键盘的,或者自己定义的类似popwindow类似效果的时候
点击其他地方的时候,自己定义的布局会自动关闭。
下面是处理的代码
/***
* 点击输入框的时候关闭输入法和上啦布局
*/
@Override
public boolean onTouchEvent(MotionEvent event) {
// TODO Auto-generated method stub
InputMethodManager imm = (InputMethodManager) this.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(et_code.getWindowToken(), 0);
imm.hideSoftInputFromWindow(et_buyfund_one.getWindowToken(), 0);
imm.hideSoftInputFromWindow(et_comm_buyfund_pwd.getWindowToken(), 0);
ll_bottom_pop_trans.setVisibility(View.INVISIBLE);
scll_transformnow.fullScroll(ScrollView.FOCUS_UP);
return super.onTouchEvent(event);
}
下面是效果图
以上就是在开发中自己定义的一个类似弹出框的处理,再次记录下次遇见直接拿来用。