动作栏和动作栏表纯白色{ANDROID}

时间:2013-12-23 04:49:02

标签: android android-actionbar android-tabs android-styles

我们如何才能将操作栏和操作栏标签设为纯白色。我使用android-support-v7-appcompat库来支持向后兼容性。 style / Theme.AppCompat.Light.DarkActionBar给出纯黑色但风格/ Theme.AppCompat.Light不给出纯白色。

1 个答案:

答案 0 :(得分:2)

没有默认主题可以提供白色操作栏。您需要为自己的应用制作自定义操作栏。

开发人员文档有一篇关于自定义操作栏的文章。

https://developer.android.com/training/basics/actionbar/styling.html

这些是您需要更改的自定义样式。

  

RES /值/的themes.xml

请参阅 android:background 标记,您可以在其中为操作栏设置drawable。

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!-- the theme applied to the application or activity -->
    <style name="CustomActionBarTheme"
           parent="@style/Theme.Holo.Light.DarkActionBar">
        <item name="android:actionBarStyle">@style/MyActionBar</item>
    </style>

    <!-- ActionBar styles -->
    <style name="MyActionBar"
           parent="@style/Widget.Holo.Light.ActionBar.Solid.Inverse">
        <item name="android:background">@drawable/actionbar_background</item>
    </style>
</resources>

将主题应用到您的应用中。

  

&lt; application android:theme =“@ style / CustomActionBarTheme”... /&gt;

相关问题