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 the target-api<21 can build a res/ Values-21 directory placement belongs to material related style

Customize the color Palette custom palette CustomizationColor-basedThe theme that fits your brand, you can use the properties in the material theme to customize the color when you inherit the material theme

<resources>  <!--inherit from the material theme --  <style name="Apptheme" Parent="Android:Theme.Material">    <!--Main Theme Colors -    <!--your app branding color for the app bar -    <Item Name="Android:colorprimary">@Color/Primary</Item>    <!--Darker variant for the status bar and contextual app bars -    <Item Name="Android:colorprimarydark">@Color/Primary_dark</Item>    <!--Theme UI controls like Checkboxes and the text fields -    <Item Name="Android:coloraccent">@Color/Accent</Item>  </style></resources>
Customize the status bar custom state barsThe 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, and when specified, it changes the Theme of the current view and its child view.


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

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.