The App-> Activity-> Custom Dialog example uses Activity to implement a Custom Dialog box. CustomDialogActivity has no special characteristics. The key point is its definition in AndroidManifest. xml:
<Activity android: name = ". app. CustomDialogActivity"
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>
CustomDialogActivity uses the CustomDialog style (Theme ).
Android applications can use custom Theme, which is a set of related Style definitions and can be applied to an Activity or the entire Application. One advantage of Theme is that you can define a uniform UI style (uniform background color, Font, etc.) for the entire application ).
Defining Theme is the same as defining Style. It must be defined in the/res/values subdirectory. The root element is resources. The difference between Theme and Style is that Theme is applied to Activity and Application, and Style is applied to a single View. The definition methods are consistent. Style definition supports Inheritance, that is, the new Style can be defined based on the system or previously defined Style:
For example, Theme. CustomDialog is defined as a WindowsBackground attribute that is modified only based on the Android dieme style (parent) and uses a brown background.
<Style name = "Theme. CustomDialog" parent = "android: style/Theme. Dialog">
<Item name = "android: windowBackground"> @ drawable/filled_box </item>
</Style>
Author: mapdigit