Android Apidemos Sample Resolution (4) App->activity->custom Dialog

Source: Internet
Author: User
Tags filter definition

App->activity->custom Dialog example uses an 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 used the Customdialog style (Theme).

Android apps can use custom interface styles (Theme), Theme for a set of related style definitions that can be applied to an activity or the entire application. One advantage of using theme is that you can define a uniform interface style for the entire application (uniform background color, font, etc.).

Defining Theme and defining style, you must define a/res/values subdirectory in which the root element is named resources, and Theme and style differ in that the Theme is applied to the activity and application Style is applied to a single view. The method of definition is consistent. The style definition supports inheritance, which means that you can define a new style based on either a system-defined style or a previously defined style:

such as the Theme.customdialog definition is based on the Android dialog style (parent) and only modified Windowsbackground properties, using a brown background.

<style name= "Theme.customdialog" parent= "Android:style/theme.dialog" >

<item name= "Android:windowbackground" > @drawable/filled_box</item>

</style>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.