第一种:
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);
}
posted on 2016-08-15 14:53  Snow〃冰激凌  阅读(350)  评论(0编辑  收藏  举报