2013-12-23 50 views
1

我们如何使动作栏和动作栏选项卡变为纯白色。我正在使用android-support-v7-appcompat库来支持向后兼容性。风格/ Theme.AppCompat.Light.DarkActionBar给纯黑色,但风格/ Theme.AppCompat.Light不提供纯白色。动作栏和动作栏选项卡纯白色{ANDROID}

回答

2

没有默认的主题会给白色的操作栏。您需要为您的应用制作自定义的操作栏。

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

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

这些都是你需要改变自定义样式。

RES /价值/的themes.xml

安卓背景标签,您可以设置为操作栏绘制。

 
<?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> 

将主题应用于您的应用。

<应用软件Android:主题= “@风格/ CustomActionBarTheme” .../>

+0

我们可以设置一个绘制的动作栏选项卡就像我们设置操作栏actionBar.setBackgroundDrawable(getResources() .getDrawable(R.drawable.shadow)); –

+0

是的,你可以做到这一点。检查样式资源,你将能够找出如何做到这一点。 –

+0

可以请你给我举个例子。我无法做到这一点。 –