Customizing the use of Alertdialog controls (Androidstudio)

Source: Internet
Author: User

Alertdialog the first type: Customizable controls are free to customize

The first step: Customizing the Popup page, creating a new XML page if you do not need activity

Step two: Set a button popup page on the main page(The following is the main code call that is automatically displayed in the Alertdialog as an XML file)
Final Alertdialog Dialog =New Alertdialog.builder (Container.getcontext ()). Create ();//Instantiate a Alertdialog
Dialog.show (); Initialize the Alertdialog
Dialog.getwindow (). Clearflags (Windowmanager.layoutparams.flag_not_focusable | Windowmanager.layoutparams.FLAG_ALT_FOCUSABLE_IM);< Span style= "color: #000080; Font-weight:bold; " >
Dialog.getwindow (). Setsoftinputmode (Windowmanager.layoutparams.soft_input_state_visible); Specifies that the IME is displayed in the window to set the input method visibility
Final Window window = Dialog.getwindow ();//instantiation of a window
Window.setcontentview (r.layout. activity_alert_error_document);//Call custom XML to show in Alertdialog
TextView Txtdocumentnumber = (TextView) Window.findviewbyid (r.id. Txtdocumentnumber);//The control that gets the custom XML

Customizing the use of Alertdialog controls (Androidstudio)

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.