项目中关闭软键盘
// 关闭键盘
public void keyboard(Activity context) {
if (context == null) {
return;
}
final View v = context.getWindow().peekDecorView();
if (v != null && v.getWindowToken() != null) {
InputMethodManager imm = (InputMethodManager) context.getSystemService(context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
}
}
将上面的方法放到 BaseActivity 和 BaseFragment 里在想关闭软键盘的时候就可关闭了