android – 对话框解除后隐藏软键盘
作者:互联网
我想在AlertDialog解雇后隐藏软键盘,但它仍然可见.这是我的代码:
alert = new AlertDialog.Builder(MyActivity.this);
imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
alert.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
}
});
解决方法:
在Manifest xml中
android:windowSoftInputMode="stateAlwaysHidden"
It will automatically hide soft keyboard on Dismiss of
Dialog
标签:android,keyboard,hide,android-softkeyboard,soft-keyboard 来源: https://codeday.me/bug/20190930/1834981.html