我正在使用兼容性库 v7。
我只是想将我的操作栏的颜色(适用于 Android 2.1 及更高版本 - 尽管我运行 Android 4.4.2)设置为纯色。
但是颜色没有变化。它保持不变。
我也尝试过用颜色创建一个实体可绘制对象,但这也没有改变。
最后,我测试了是否可以更改布局的背景,并且我可以 - 它一定是关于我没有得到的操作栏背景。
这是代码:
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="CustomActionBarTheme"
parent="@style/Theme.AppCompat.Light.DarkActionBar">
<!-- Support library compatibility -->
<item name="actionBarStyle">@style/MyActionBar</item>
</style>
<style name="MyActionBar" parent="@style/Widget.AppCompat.ActionBar">
<item name="android:background">#0000ff</item>
</style>
</resources>