更新时间:2021-12-19 02:55:17
转载请注明 http://blog.csdn.net/eclipsexys 翻译自Developer Android,时间仓促,有翻译问题请留言指出,谢谢
要自定义主题的基础颜色,以适应你的品牌,使用的时候,你从材料主题主题继承属性定义自定义颜色:
系统部件
触摸反馈的动画为系统部件
Activity过渡动画
@android:style/Theme.Material (dark version) @android:style/Theme.Material.Light (light version) @android:style/Theme.Material.Light.DarkActionBar
对于可以使用的材料样式的列表,请参阅R.style的API参考。
<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>
Creating Apps With Material Design —— Using the Material Theme
Creating Apps With Material Design —— Working with Drawables
Creating Apps With Material Design —— Maintaining Compatibility
Creating Apps With Material Design —— Creating Lists and Cards
Creating Apps With Material Design —— Defining Shadows and Clipping Views
Creating Apps With Material Design —— Defining Custom Animations