Let's review the general steps for creating Alertdialog. A inflate alertdialog layout file for example, whereThe DLG is our layout file. View layout = Layoutinflater.from (CTX). Inflate (R.layout.dlg, NULL);
Two construction Alertdialog.builderAlertdialog.builder dialogbuilder = new Alertdialog.builder (CTX);Three settings dialog some properties such as how many buttons, there is no title, if there is so the title of the text is what, and you can also set the listener of each button four layout settings to the dialog boxDialogbuilder.Setview (Layout)Five Create dialog box Alertdialog dlg = Dialogbuilder.create (); Six Display dialog dlg.show ();
Today, we want to display the input method at the same time as the dialog box is displayed. We know that the activity is set to Androidmanifest. However, Alertdialog requires some special handling. The basic method is to modify the window properties of the Alertdialog after creating the dialog box. The code is as follows: Dlg.getwindow (). Setsoftinputmode (WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
Isn't it simple?
From for notes (Wiz)
Automatically eject IME in the Alertdialog dialog box with EditText controls