Dialog弹出时,EditView获取焦点,软件盘弹出
2017-12-11 本文已影响0人
吕志豪
AlertDialog alertDialog = builder.create();
alertDialog.setOnShowListener(dialog -> {
inflate.etContent
.post(() -> {
inflate.etContent.requestFocus();
InputMethodManager imm =
(InputMethodManager)
builder.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm != null) {
imm.showSoftInput(inflate.etContent, InputMethodManager.SHOW_IMPLICIT);
}
});
});