Android Learning notes 38--styles and themes

Source: Internet
Author: User

Style, Theme

Styling and theme resources are all used to beautify your Android app.

Styles: A collection of formats that can be reused.

The Android style resource is stored with the Res/values folder, its root element is <resources.../>, and the element can contain multiple <style> child elements, each <style> defines a style. \

The <style> element specifies the following properties:

1.name

2.parent: Specifies the parent class style that the style inherits from. When a style inherits from a parent style, the style gets all the styles defined in the parent style, and the current style can override the style specified in the parent class style.

The <style> element can be wrapped over multiple <item.../> sub-elements, each <item. /> defines a format item.

Eg:

Application Method:

Topic Resources

The theme resource XML file is also stored under the Res/values folder, the root element is <resources.../>, and the theme is defined using the <style> element.

The difference between theme resources and styles:

1. The theme cannot be used as a single view component, and the subject should function for all activity in the entire app or for the specified activity;

2. The format of the theme definition should be to change the appearance of the window format, such as the window title, window border, etc.;

Topic Resources also support inheritance relationships:

Several built-in theme resources, such as:theme.dialog==>, are available in the Android system.

Instance Use procedure:

Android Learning notes 38--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.