Create material Design-style Android apps-app theme

Source: Internet
Author: User

The Android 5 was officially released yesterday, and the Android developer site was updated, adding an Android app guide that created material design style, and also updated the support Library in support The library adds some material design-style controls and animations, and here's a quick introduction to how to develop material design-style Android apps.

Android 5 using material design style

Android offers three kinds of material design style theme.

respectively:

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

Light Material Theme

Dark Material Theme

We can define our theme with these three theme, for example:

<resources>  <!--inherit from the material theme to  <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 text--    <item name= "Android:coloraccent" > @color/accent</item>  </style></resources>

We can modify the color of the word or background for each position, with the name of each location as shown:

I would like to introduce a simple, more specific to explore it yourself.

Lower version uses material design style

To use the material design style on a lower version, you will need to use the latest support library (version 21) to bring the project directly into the project, or build it using Gradle to add compile dependency:

dependencies {    compile ' com.android.support:appcompat-v7:+ '    compile ' com.android.support:cardview-v7:+ '    compile ' com.android.support:recyclerview-v7:+ '}

Put the above apptheme style to Res/values-v21/style.xml, and then res/values/style.xml add a Apptheme, as follows:

<!--extend one of the Theme.appcompat themes--><style name= "Theme.mytheme" parent= "Theme.AppCompat.Light" >    <!--Customize the color palette-    <item name= "colorprimary" > @color/material_blue_500< /item>    <item name= "Colorprimarydark" > @color/material_blue_700</item> <item name=    " Coloraccent "> @color/material_green_a200</item></style>

This can be done in much the same way as material Design, but there are some effects that cannot be achieved because the low version does not support an immersive status bar.

PS: Just write so much. Next write use CardView and Recyclerview. Make the material design list and card layout. (My English is not good, maybe some places also understand bad.) )

Reference:http://developer.android.com/training/material/theme.html

Original address: http://blog.isming.me/2014/10/18/creating-android-app-with-material-design-one-theme/, reproduced please indicate the source.

Create material Design-style Android apps-app 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.