Android styles (style) and themes (theme)

Source: Internet
Author: User

Notice we used the @ symbol and? Symbol to apply the resource.

The @ symbol indicates that the resources we have applied are defined previously (either in the previous project or in the Android framework).

Question mark? Indicates that the value of the resource we are referencing has been defined in the current topic.

The differences between themes and styles differ mainly in

a theme cannot act on a single view build, and the theme should work for all the activity in the entire app or for the specified activity .

The format of the theme definition should be to change the appearance of the window format, such as window variants, window borders and so on.

Theme must be defined in the <application> or <activity> in androidmanifest.xml for the entire activity or for the entire application.

style is for view , such as Textview,edittext.

Choose a theme based on the Android version:
<name= "Lightthemeselector"  parent= "Android:Theme.Light " >  </ style >  
Parent= "Android:theme instead of parent=" @android: Style/theme

Activity references can have @android: style/

<android:theme= "@android: style/theme.translucent">

or directly:

< Activity Android:name =". Mainactivity "android:theme=" @style/theme ">

Styles can :

The inheritance of a style can be inherited through the parent property to inherit the style that is already defined by Android

If an app uses theme, and the view in the app uses a style, the style takes precedence over the theme when theme conflicts with style style

Android styles (style) and themes (theme)

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.