I'm trying to change the action bar in my activities via XML.
As suggested in this answer and similar answers, I defined two styles. One AppTheme
to set in the activities (or application) tag in my manifest file. The other to define the action bar itself, MyActionBarTheme
. Very simply:
<style name="AppTheme" parent="Theme.AppCompat.Light">
<item name="actionBarStyle">@style/MyActionBarTheme</item>
</style>
<style name="MyActionBarTheme" parent="@android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">#F00</item>
</style>
I set the AppTheme for the whole app:
<application android:theme="@style/AppTheme">
<activity android:name=".settings.DeleteAccountActivity"
android:label="Delete Account">
</activity>
...
I even tried to specifically set the theme for my activity:
<application android:theme="@style/AppTheme">
<activity android:name=".settings.DeleteAccountActivity"
android:label="Delete Account"
android:theme="@style/AppTheme">
</activity>
...
which I know is redundant.
What happens is this:
If I don't set the actionBarStyle, I see the standard action bar. However, If I set my actionBarStyle, the actionBar disappears completely.
I've tried some other things, like
<item name="actionBarWidgetTheme">@style/MyActionBarTheme</item>
and <item name="actionBarTheme">@style/MyActionBarTheme</item>
or specifically setting <item name="windowActionBar">true</item>
and using
<style name="MyActionBarTitleText"
parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textColor">#F00</item>
</style>
but the same thing happens. The action bar disappears completely. Any idea as to what causes this and how I can fix this?
Update
I just noticed that I set "actionBarStyle" and not "android:actionBarStyle". But when I do write the "android:", it still doesn't take MyActionBarTheme
, but instead looks just like I haven't set "actionBarStyle" at all.