使用材料设计主题

原文地址:http://developer.android.com/training/material/theme.html html

材料设计主题提供如下内容
android

一、系统组件能设置颜色面板app

二、系统组件支持触摸反馈动画动画

三、activity移动动画spa

你能够根据你的品牌颜色控制材料设计主题。你能够使用主题属性给actionbar和status bar上色。
.net

系统组件有新的设计和触摸动画。你能够自定义颜色面板、触摸反馈和activity移动。设计

材料设计主题定义了三种:code

一、@android :style/Theme.Materialhtm

二、@android :style/Theme.Material.Light继承

三、@android :style/Theme.Material.Light.DarkActionBar

材料设计主题只支持android5.0以上的版本,v7包提供的材料设计主题样式,支持部分组件。

定义颜色面板

当继承材料主题后,能够经过自定义主题的颜色属性匹配品牌。

<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 text fields -->
   
<item name="android:colorAccent">@color/accent</item>
 
</style>
</resources>

自定义status bar

材料主题让你能轻松的自定义status bar,你能够指定颜色。设置status bar的颜色,使用android:statusBarColor属性,默认android:statusBarColor是继承android:colorPrimaryDark。

相关文章
相关标签/搜索