Android (lollipop/5.0) Material Design (iii) using Material themes

Source: Internet
Author: User

Website address:https://developer.android.com/intl/zh-tw/training/material/theme.html

The new material theme provides:

System widgets can set their palette

Touch Feedback animation for system widgets

Transition animations for activity

You can customize the material theme and use a palette to control it based on your brand identity.

You can use the theme properties to color the action bar and status bar:



Definition of Material theme:
@android: style/theme.material (Dark Version)
@android: Style/theme.material.light (Light version)
@android: Style/theme.material.light.darkactionbar

Note: Material theme can only be 5.0 (API21) and above to use SUPPORT-V7 to provide compatible support, on target-api<21 can build a res/values-21 directory to place the material related style

Customize The color Palette a custom palette

Customize color -based themes for your brand, and when you inherit the material theme, you can use the properties in the material theme to customize colors

Customize the status bar custom state bars

The material theme allows you to easily customize the status bar, so you can specify a color that fits your brand and provide enough contrast to display the white status icon,

When you inherit from a material theme, you customize the color when you set the status bar: Android:statusbarcolor. By default, Android:statusbarcolor inherits the Android:colorprimarydark.

You can draw the status bar yourself. For example, if you want to display the status bar clearly in a photo, use a subtle black gradient to make sure the White status bar icon is visible. To do this, set the Android:statusbarcolor property to @android:color/transparent and adjust the window's flags as needed. For animations or fades (fading), you can also use the Window.setstatusbarcolor () method

When you customize the navigation and status bar, either make them transparent or just modify the status bar. The navigation bar must remain black in all other cases.

Theme individual views Personal theme View

In the XML definition of layout, you can use Android:theme to specify the theme that the view applies to, specifying that it will change the theme of the current view and its child view.

Android (lollipop/5.0) Material Design (iii) using Material 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.