AlertDialog.Builder property collection

  1. Introduction to AlertDialog: The constructor of AlertDialog is declared as protected, so you cannot directly use the new keyword to create an object instance of the AlertDialog class. To create an AlertDialog dialog, you need to use the Builder class, which is an embedded class defined in the AlertDialog class. Therefore, you must create an object instance of the AlertDialog.Builder class, and then call show() to display the dialog.

    例如:    AlertDialog.Builder db= new Builder(this);

                    db..create().show();

 2. Property introduction
1 AlertDialog.Builder property 
* setTitle: Set the title for the dialog box;
* setIcon: Set the icon for the dialog box;
* setMessage: Set the content for the dialog box;
* setView: Set the custom style for the dialog box;
* setItems: Set a list to be displayed in the dialog box, generally used to display several commands;
* setMultiChoiceItems: used to set the dialog box to display a series of checkboxes;
* setNeutralButton: Response to neutral behavior clicks;
* setPositiveButton: Response to Yes/Ok * setNegativeButton : respond to the click
of No/Cancel;
* create : create a dialog box;
* show : display a dialog box;
2 ProgressDialog properties
*setProgressStyle: set the style of the progress bar, the style is circular, rotating; 
*setTitlt: set ProgressDialog title;
*setMessage: Set ProgressDialog prompt information;
*setIcon: Set ProgressDialog title icon;
*setIndeterminate: Set ProgressDialog progress bar is unclear;
*setCancelable: Set whether the ProgressDialog can be canceled by pressing the return key;
*setButton: Set a Button of the ProgressDialog (need to monitor the Button event); 
*show: Display the ProgressDialog.

Types of dialogs can be created, such as: with buttons, simple lists, single-select lists, multi-select lists, horizontal progress or circle dialogs (default: circle), floating dialogs, and dialogs that can be closed by touching anywhere boxes, etc., you can also customize the dialog

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326858794&siteId=291194637