1.自定义dialog
Dialog dialog = new Dialog(MainActivity.this, R.style.dialog); dialog.setContentView(R.layout.dialog); dialog.setCanceledOnTouchOutside(true); dialog.setCancelable(true); final EditText edt = (EditText) dialog.findViewById(R.id.edt);
2.设置监听 dialog.setOnShowListener(new DialogInterface.OnShowListener() { @Override public void onShow(DialogInterface dialogInterface) {
3.弹出软键盘 InputMethodManager im = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); im.showSoftInput(edt, InputMethodManager.SHOW_IMPLICIT); } }); dialog.show();