我已经阅读了许多关于更改操作栏颜色的答案,但似乎无法使其工作。下面是我有:Android操作栏不能反映颜色变化
styles.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light">
<item name="android:actionBarStyle">@style/MyActionBar</item>
</style>
<!-- ActionBar styles -->
<style name="MyActionBar" parent="Theme.AppCompat.Light">
<item name="android:windowBackground">@color/actionBarBackground
</item>
</style>
</resources>
我也试过
<item name="android:Background">#F33</item>
AndroidManifest.xml中
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
我所有的活动已经扩展'AppCompatActivity' 您发布的代码似乎与我拥有的代码完全相同,除非我错过了某些内容。 我在清单本身的活动中添加了我的样式,并在应用程序调用该活动后更改了背景,但只适用于活动。应该有一个活动栏的活动?我错过了一个清晰的概念。 – Cliff
@Cliff我不知道你是否在你的布局中使用工具栏。在这种情况下发布你的代码。否则,操作栏的颜色由活动使用的主题中的colorprimary attrr定义。在你的主题中,我没有看到它。 –
in menu_main我有 '
' – Cliff