Automatically eject IME in the Alertdialog dialog box with EditText controls

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.