简体   繁体   English

拆分操作栏底部颜色

[英]Split action bar bottom color

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. 效果很好,但是底部栏中的菜单操作按钮(在res/menu )为灰色背景。

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 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 . 我最初使用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));

尝试这个

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM