在Android开发中,当EditView中的内容输入完毕后,通常需要隐藏编辑时自动弹出的软键盘,我们常常使用InputMethodManager方法来隐藏软键盘,如下所示:
- private void hideSoftKeyBoard(View view) {
- if (view != null) {
- InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
- imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
- }
- }