android-dialog Box Steps to Implement a dialog box dialog
1 Common dialog boxes:
Alertdialog (Pop-up dialog box)
Datepickerdialog (Date selection dialog box)
Timepickerdialog (Time selection dialog box)
Build Method:
Alertdialog _alertdialog = new Alertdialog.builder (mycontentmenuactivity.this). Create ();
Builder design mode is suitable for when the construction parameters are more
2 Setup steps:
Creating an Alertdialog.builder instance in the Oncreatedialog method
Alertdialog.set the corresponding property
Build instance. Create () generates an instance of Alertdialog
Alertdialog.show (), also create () on show
3 Build button:
Call the Setpositivebutton () and Setnegativebutton () method when builder
Two custom dialog
1 direct use of the Base class dialog objects to Setcontentview to present different dialog, you can see dialog and
Activity is very similar
2 Customize with Alertdialog objects created directly Setview
Alertdialog.builder Builder = new Alertdialog.builder (getactivity ());
Get the layout inflater
Layoutinflater inflater = getactivity (). Getlayoutinflater ();
Inflate and set the layout for the dialog
Pass NULL as the parent view because its going in the dialog layout
Builder.setview (inflater.inflate (r.layout.dialog_signin, NULL))
3 If you want to customize the dialog box, use the Activity as a dialog box instead of using the dialog box API.
Simply create an activity and set the theme to Theme.Holo.Dialog in the <activity> manifest manifest element.
<activity android:theme= "@android: Style/theme.holo.dialog" >
android-dialog box