在扩展material.light主题并设置如下颜色之后:
<resources>
<!-- inherit from the material theme -->
<style name="MiTemaMaterial" parent="android:Theme.Material.Light">
<!-- Main theme colors -->
<!-- your app branding color for the app bar -->
<item name="android:colorPrimary">#4DB6AC</item>
<!-- darker variant for the status bar and contextual app bars -->
<item name="android:colorPrimaryDark">#009688</item>
<!-- theme UI controls like checkboxes and text fields -->
<item name="android:colorAccent">#FFAB40</item>
</style> </resources>
我得到了一个像desing一样的材料导航栏,但像按钮这样的视图不知道这是否是标准行为,因为在这里的设计指南http://www.google.com/design/spec/components/buttons.html似乎butttons使用强调色 .
我必须手动设置它们吗?
1 回答
是的,您需要自己设置按钮主题 . 要提供一个采用原色的按钮,请在v21目录中使用drawable作为背景,例如:
这将确保您的背景颜色为
?attr/colorPrimary
,并使用默认的?attr/colorControlHighlight
(如果您愿意,也可以在主题中设置)具有默认的波纹动画 .注意:您必须为小于v21创建自定义选择器:
假设你有一些颜色,你想要默认,按下和聚焦状态 . 就个人而言,我通过选择中途获取了一个波纹的截图,并将主要/聚焦状态拉出来 .