dialog use of the system is sometimes not very beautiful, you want to design a dialog interface, the following is the dialog interface can be designed:
Public classCustomdialogextendsDialog {intLayoutres;//context Context; PublicCustomdialog (Context context) {Super(context); This. Context =context; } PublicCustomdialog (Context context,intreslayout) { Super(context); This. Context =context; This. Layoutres =reslayout; } /** * * @paramContext *@paramTheme *@paramReslayout*/ PublicCustomdialog (Context context,intThemeintreslayout) { Super(context, theme); This. Context =context; This. Layoutres =reslayout; } @Overrideprotected voidonCreate (Bundle savedinstancestate) {Super. OnCreate (savedinstancestate); This. Setcontentview (Layoutres); }}View Code
When using the direct instantiation, add the layout file can be
Customdialog dialog=New customdialog (This, R.style.customdialog, R.layout.customdialog) ;
Adding properties of dialog in Value/styles.xml
<style name= "Customdialog" parent= "@android: Theme.dialog" > <item name= "Android:windowframe" >@ Null</item> <item name= "Android:windownotitle" >true</item> <item Name = "Android:windowisfloating" >true</item> <item name= "Android:windowcontentoverlay" >@ NULL</item></style>
The next thing you can do is just like the previous dialog.
Android Custom Dialog layouts