Reputation: 4733
I am trying to change the background of the action bar via xml, but the action bar is not shown anymore at all.
This is the style that I am using, declared in styles.xml
:
<style name="AppBaseTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
<item name="actionBarStyle">@style/DiaryActionBar</item>
<item name="android:actionBarStyle">@style/DiaryActionBar</item>
</style>
<style name="DiaryActionBar"
parent="@style/Theme.AppCompat.Light.DarkActionBar">
<item name="background">@color/action_bar_bg</item>
<item name="android:background">@color/action_bar_bg</item>
</style>
I have set both android:background
and background
for compatibility. This is the only styles.xml
file in my app. What am I doing wrong?
Upvotes: 0
Views: 90
Reputation: 1423
For changing background and actionBarStyle from android styling.You can do like this..
<style name="AppBaseTheme" parent="@android:style/Theme.Black">
<item name="android:actionBarStyle">@style/Theme.DeviceDefault.NoActionBar</item>
</style>
<style name="DiaryActionBar" parent="@android:style/Theme.Black">
<item name="android:background">@color/action_bar_bg</item>
</style>
Upvotes: 0
Reputation: 3794
In my style with custom actionbar background, i have this:
<style name="Theme.Malaka" parent="@style/Theme.AppCompat">
<style name="Malaka.ActionBar" parent="@style/Widget.AppCompat.ActionBar">
And that works just fine. Items of the styles are the same as yours. Please note that the parent of Malaka.ActionBar
is not Theme...
but Widget...
Upvotes: 1