1. In the AndroidManifest. xml file, declare that the theme of the activity uses the custom dialog box style.
<Activity android: name = ". SensorGetValueActivity"
Android: label = "@ string/activity_custom_dialog"
Android: theme = "@ style/Theme. CustomDialog">
<Intent-filter>
<Action android: name = "android. intent. action. MAIN"/>
<Category android: name = "android. intent. category. SAMPLE_CODE"/>
</Intent-filter>
</Activity>
2. Define a Dialog box Theme style in the res/values/styles. xml style file, which inherits the android: style/Theme. dieme topic, www.2cto.com
And the window style android: windowBackground references @ drawable/filled_box
<Style name = "Theme. CustomDialog" parent = "android: style/Theme. Dialog">
<Item name = "android: windowBackground"> @ drawable/filled_box </item>
</Style>
3. res/drawable/filled_box.xml defines the drawable (Abstract printable area) of the Shape type. It is used to implement the style of the new dialog box.
<Shape xmlns: android = "http://schemas.android.com/apk/res/android">
<Solid android: color = "# f0600000"/>
<Stroke android: width = "3dp" color = "# ffff8080"/>
<Corners android: radius = "3dp"/>
<Padding android: left = "10dp" android: top = "10dp"
Android: right = "10dp" android: bottom = "10dp"/>
</Shape>