App->activity->custom Dialog Example using Activity to implement a custom dialog box
The class customdialogactivity itself is nothing special. 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 a custom Customdialog style (Theme).
Android apps can use a custom interface style (Theme), Theme as a set of related style definitions that can be applied to an activity or to an entire application. One advantage of using theme is that you can define a unified interface style (uniform background color, font, and so on) for the entire application.
Defining Theme and defining a style, it must be defined in the/res/values subdirectory, where the root element is named resources, the difference between Theme and style is Theme applied to activity and application and The style is applied to a single view. The method of definition is consistent.
The style definition supports inheritance, which can be based on a system-defined style or a previously defined style when defining a new style:
such as the Theme.customdialog definition is based on the Android dialog style (parent) and only modified Windowsbackground properties, using a brown background.
for a custom dialog appearance. Here we use an ugly -- <style name= "Theme.customdialog" parent= "Android:style/theme.dialog" > <item name= "Android:windowbackground" > @drawable/filled_box</item> </style>
The background uses shape,filled_box.xml as follows:
<shape xmlns:android= "Http://schemas.android.com/apk/res/android" > <solid android:color= "#f0600000" /> <stroke android:width= "3DP" android:color= "#ffff8080"/> <corners android:radius= "3DP"/> <padding android:left= "10DP" android:top= "10DP" android:right= "10DP" android:bottom= "10DP"/ ></shape>
"Sail Plan 005" 2015 Sail plan Android Apidemo The Devil's pace app->activity->custom Dialog Dialog form of activity,theme use, shape use