1. 隐藏软键盘
private void hideKeyboard() { final Activity activity = getActivity(); if (activity != null) { View view = activity.getCurrentFocus(); InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getWindowToken(), 0); } }