隐藏键盘
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
assert imm != null;
imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
在fragment中
InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
assert imm != null;
imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);