當(dāng)dialog中包含EditeText的時(shí)候,假如當(dāng)前軟鍵盤是彈出的狀態(tài),當(dāng)dialog執(zhí)行dismiss()的時(shí)候該軟鍵盤并不會(huì)消失。如果需要軟鍵盤隱藏,重寫dismiss()方法

Screenshot_20180302-104014.png
@Override
public void dismiss() {
View view = getCurrentFocus();
if (view instanceof TextView) {
InputMethodManager mInputMethodManager = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
mInputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.RESULT_UNCHANGED_SHOWN);
}
super.dismiss();
}