Now we want to implement a custom Dialog, mainly involving the style File style. Refer to the case and write your own code for implementation. First, create an Android Project -- CustomDialog, and then create an xml file filled_box.xml In the res/drawable folder. Its content is: <? Xml version = "1.0" encoding = "UTF-8"?> <Shape xmlns: android = "http://schemas.android.com/apk/res/android"> <solid android: color =" # ffff0000 "/> <stroke android: width = "3dp" color = "#00ffff80"/> <corners android: radius = "2dp"/> <padding android: left = "10dp" android: top = "10dp" android: right = "10dp" android: bottom = "10dp"/> </shape> This file mainly draws a rounded rectangle (shape android: the default value of the shape attribute is rectangle, so it is not set as a rectangle. The default value is a rectangle .), Set the fill color to # ffff0000, Which is solid. The rounded corner size is 2dp, Which is corners. the padding item mainly controls the alignment of each side, stroke items are mainly border effects. For more information about shape, see Dev Guide> Framework Topics> Application Resources> Resource Types> Drawable. The next step is to create the styles. xml style file in the res/values directory. The content is as follows: <? Xml version = "1.0" encoding = "UTF-8"?> <Resources> <style name = "Theme. customDialog "parent =" android: style/Theme. dialog "> <item name =" android: windowBackground "> @ drawable/filled_box </item> </style> </resources> Theme. customDialog is the name of a custom topic. The parent attribute specifies that the parent topic of a topic is android: style/Theme. dialog, this topic has been used in the case of "Dialog Prompt window", and then the window background is specified as the shape defined previously through filled_box through the item with name for android: windowBackground. Now that you have a theme style definition, you only need to add the theme items used for the Activity. The processing method of the previous case "Dialog Prompt window" is the same. Open AndroidManifest. xml file. Add the property android: theme = "@ style/Theme in the Activity definition. customDialog. Now you can run the project to see the custom effect.