我正在为我的应用做一个简单的自定义,我想在Action Bar中添加自定义背景颜色。这是我在styles-v14
文件夹中的styles.xml。 (我的应用仅针对SDK 14及更高版本。)
如果我只是取消注释此行并运行我的应用程序,整个屏幕将变为白色,状态栏除外,而我希望操作栏背景颜色为不同颜色。
<!-- <item name="android:actionBarStyle">@style/WindowTitleBackground</item> -->
知道出了什么问题。这是我的App清单:
<application
android:name=".App"
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
styles.xml
<resources>
<!--
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
-->
<style name="AppTheme" parent="@android:style/Theme.Holo.Light.DarkActionBar">
<item name="android:listChoiceIndicatorSingle">@drawable/btn_radio_holo_light</item>
<!-- <item name="android:actionBarStyle">@style/WindowTitleBackground</item> -->
</style>
<style name="RadioButtonAppTheme" parent="android:Widget.CompoundButton.RadioButton">
<item name="android:button">@drawable/btn_radio_holo_light</item>
</style>
<style name="WindowTitleBackground">
<item name="android:background">@color/titlebackgroundcolor</item>
</style>
</resources>
答案 0 :(得分:1)
尝试在parent
样式
ActionBar
属性
<style name="WindowTitleBackground"> parent="@android:style/Widget.Holo.ActionBar"
<item name="android:background">@color/titlebackgroundcolor</item>
</style>