【发布时间】:2015-02-25 03:06:51
【问题描述】:
由于某种原因,这个设置只是给了我默认的操作栏背景颜色。
styles.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="android:actionBarStyle">@style/MyActionBar</item>
</style>
<style name="MyActionBar"
parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">#d73830</item>
</style>
</resources>
AndroidManifest.xml
<application
android:allowBackup="true"
android:icon="@drawable/logo"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
...
</application>
在 activity_main.xml 中,我的主题设置为“AppTheme”。
【问题讨论】:
-
您使用的是 appcompat v21 或更早版本吗?如果是 appcompat v21,您需要定义应用的原色,它将用于工具栏。