Styles and Themes

Source: Internet
Author: User

"Styles and Themes"

A- style is a collection of properties, that specify, the look and format for a View or window. A style can specify properties such as height, padding, font color, font size, background color, and much more. A style is defined in an XML resource that's separate from the XML that specifies the layout.

A theme is a style applied to an entire Activity or application, rather than an individual (as in the View example above). When a style was applied as a theme, every View in the Activity or application would apply each style property that it Suppo Rts.

To create a set of styles, save an XML file in the res/values/ directory of your project. The name of the XML file is arbitrary, but it must use the .xml extension and being saved in the res/values/ folder.

The root node of the XML file must be <resources> .

  

Each child <resources> of the element was converted into a application resource object at Compile-time, which can referenced By the value in the <style> element ' s name attribute. This example style can is referenced from an XML layout as@style/CodeFont

If you are want to inherit from styles and you've defined yourself, you don't have the parent . Instead, just prefix the name of the the style you want to inherit to the name of the your new style, separated by a period. For example, to create a new style this inherits the CodeFont style defined above, but make the color red, you can author the New style like this:

  

Reference: http://www.android-doc.com/guide/topics/ui/themes.html

Styles and Themes

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.