我用来改变AppCompat状态栏的颜色与 actionBarStyle
,并创建一个背景,是我想要的颜色的样式。
I used to change AppCompat status bar color with actionBarStyle
, and creating a style with a background which is the color I want.
现在,随着材料设计AppCompat,此方法不工作了。
Now, with Material Design AppCompat, this method doesn't work anymore.
您能帮我吗?谢谢你。
还有 colorPrimary
称为一个新的属性,你可以在你的主题定义。这会给你动作条或工具栏纯色。
There's a new attribute called colorPrimary
which you can define in your Theme. This will give you ActionBar or Toolbar a solid color.
下面一个小例子:
<style name="AppTheme" parent="Theme.AppCompat.Light">
<!-- colorPrimary is used for the default action bar background -->
<item name="colorPrimary">@color/my_action_bar_color</item>
</style>
请注意:它必须是唯一的 colorPrimary
,不是安卓colorPrimary
在每一个价值观文件夹以外的值-V21
之一。
Please note: It has to be only colorPrimary
, not android:colorPrimary
, in every values-folder except the values-v21
one.
您可以阅读更多有关自定义调色板上的developer.android.com.
You can read more about customizing the Color Palette on developer.android.com.
上一篇:Android的 - 用一个简单的字符串数组动作条搜索查看建议数组、字符串、动作、简单
下一篇:Android的工作室,标志着中的R红色与错误信息&QUOT;不能解析符号R&QUOT;但是生成成功标志着、错误信息、符号、红色