Android 隐藏软键盘方法

第一种:
public static void hideInput(Activity activity) {
View curFoc = activity.getCurrentFocus();
if (curFoc != null) {
InputMethodManager imm = (InputMethodManager) activity
.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(curFoc.getWindowToken(), 0);
}
}


第二种:
public static void hideKeyboard(Activity activity) {
InputMethodManager imm = (InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.HIDE_NOT_ALWAYS, 0);
}
原文地址:https://www.cnblogs.com/lianghui66/p/5772948.html