我正在尝试修改我的应用程序的主题。我已经能够成功地为我的应用程序设置背景颜色,并为我的操作栏设置背景颜色。
不幸的是,操作栏中项目的背景颜色采用应用程序的背景颜色,而不是操作栏的背景颜色。
这是我在 styles.xml 中的代码
<!--
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from res/values/styles.xml on API 11+ devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:actionBarStyle">@style/MyActionBar</item>
<item name="android:background">#ff0000</item>
</style>
<style name="MyActionBar" parent="@android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">#fefefe</item>
</style>
这是正在发生的事情的屏幕截图。
希望我在这里遗漏了一些愚蠢的东西......
谢谢!
最佳答案
我很确定您的主题背景已应用于一切。相反,您只希望 Activity 的背景是那种颜色。因此,与其在主题中设置背景色,不如为 Activity 设置。如果您有许多将使用此背景颜色的 Activity ,请为您的 Activity 创建一个样式并将其应用于每个 Activity 。
关于android - 我的操作栏标题使用了错误的主题颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16039071/