public static void hideKeyboard(Context context) { // 隐藏软键盘 try { InputMethodManager imm = ((InputMethodManager) context .getSystemService(context.INPUT_METHOD_SERVICE)); imm.hideSoftInputFromWindow(((Activity) context).getCurrentFocus() .getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } catch (Exception e) { } }