The System default dialog box can only display simple title content and buttons, and if you want to be more realistic, you will need to customize the dialog box, the following is the way to customize the dialog box.
1. Define the template of the dialog box first
<?XML version= "1.0" encoding= "Utf-8"?><LinearLayoutxmlns:android= "Http://schemas.android.com/apk/res/android"Android:layout_width= "300DP"Android:layout_height= "Match_parent"android:orientation= "vertical" > <TextViewAndroid:id= "@+id/tv_title"Android:layout_width= "300DP"Android:layout_height= "30DP"android:textsize= "22SP"Android:text= "Set Center"android:gravity= "Center"/><EditTextAndroid:id= "@+id/ed_password"Android:layout_width= "300DP"Android:layout_height= "50DP"android:textsize= "22SP"Android:hint= "Enter Password" /><EditTextAndroid:id= "@+id/ed_re_password"Android:layout_width= "300DP"Android:layout_height= "50DP"android:textsize= "22SP"Android:hint= "Re-enter password" /><LinearLayoutAndroid:layout_height= "Wrap_content"Android:layout_width= "300DP"android:orientation= "Horizontal"android:gravity= "Center_horizontal" > <ButtonAndroid:id= "@+id/btn_ok"Android:text= "OK"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content" /> <ButtonAndroid:id= "@+id/btn_cancel"Android:text= "Cancel"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content" /></LinearLayout></LinearLayout>
2. The dialog will then be re-rendered using the dialog box template.
New Builder (this); = View.inflate (mainactivity. thisnull); Dialog.setview (view); Dialog.show ();
3, through the above settings can be customized dialog box
Android Development Learning Note-Customize dialog box