I have split up the action bar in the manifest file like so:
android:uiOptions="splitActionBarWhenNarrow"
Which works fine, however the menu action buttons (in res/menu
) on the bottom bar are on a gray background.
I have tried various ways to change this and to get the bottom bar blue. The top action bars are blue as expected, however the bottom is the default gray and I cannot change it.
The styles.xml
<resources>
<color name="blue">#3D589B</color>
<color name="black">#000000</color>
<style name="CustomActionBarTheme"
parent="@android:style/Theme.Holo.Light.DarkActionBar">
<item name="android:actionBarStyle">@style/MyActionBar</item>
<item name="android:actionBarTabBarStyle">@style/MyActionBarbackgroundSplit</item>
<item name="android:displayOptions">showHome|homeAsUp|showTitle</item>
<item name="android:icon">@android:color/transparent</item> <!-- This does the magic! -->
</style>
<!-- ActionBar styles -->
<style name="MyActionBar"
parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">@color/blue</item>
<item name="android:backgroundStacked">@color/blue</item>
</style>
<style name="MyActionBarbackgroundSplit"
parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">@color/blue</item>
<item name="android:backgroundStacked">@color/blue</item>
</style>
</resources>
What is the appropriate style to change the bottom bar with the icons on?
After some further research (typically after I post the question) the appropriate tag is
backgroundSplit
I initially used backgroundStacked
.
So complete section looks like:
<style name="MyActionBar"
parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">@color/blue</item>
<item name="android:backgroundStacked">@color/blue</item>
<item name="android:backgroundSplit">@color/blue</item>
</style>
getActionBar().setSplitBackgroundDrawable(new ColorDrawable(Color.WHITE));
尝试这个
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.