更改动作条的标签背景颜色 [英] Change ActionBar Tabs background color

查看:129
本文介绍了更改动作条的标签背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法改变的动作条的标签栏的背景色,而不在一条线的版本改变了吗?

Is there a way to change the background color of the tab bar in the ActionBar without changing it in the one line version?

要澄清我想:在纵向模式下,动作条被分成两行,在动作条本身和下面的选项卡。在横向模式选项卡在实际动作条。

To clarify what I want: In portrait mode the ActionBar is split in two lines, the ActionBar itself and the tabs below. In landscape mode the tabs are in the actual ActionBar.

我想改变纵向模式的背景色。如果我改变背景的TabView的,它会为这两种模式被改变。我一定要创造那些独立的风格?这带来了第二个问题:有没有办法知道什么时候会是两条线,当不

I want to change the background color of the portrait mode. If I change the background in the TabView it'll be changed for both modes. Do I have to create separate styles for those? Which brings up a second question: is there a way to know when it'll be two lines and when not?

或者,我只是失去了一些东西?

Or am I just missing something?

我用ActionBarSherlock顺便说一句

I'm using ActionBarSherlock btw

推荐答案

我认为你正在寻找的安卓backgroundStacked 的动作条的风格属性:

I think you are looking for the android:backgroundStacked attribute of the ActionBar style:

<style name="MyTheme" parent="android:Theme.Holo.Light">
    <item name="android:actionBarStyle">@style/MyActionBarStyle</item>
</style>

<style name="MyActionBarStyle" parent="@android:style/Widget.Holo.Light.ActionBar.Solid">
    <item name="android:backgroundStacked">@drawable/my_stacked_background</item>
</style>

或者(如果使用ActionBarSherlock):

or (If using ActionBarSherlock):

<style name="MyTheme" parent="@style/Theme.Sherlock.Light">
    <item name="android:actionBarStyle">@style/MyActionBarStyle</item>
    <item name="actionBarStyle">@style/MyActionBarStyle</item>
</style>

<style name="MyActionBarStyle" parent="@style/Widget.Sherlock.Light.ActionBar.Solid">
    <item name="android:backgroundStacked">@drawable/my_stacked_background</item>
    <item name="backgroundStacked">@drawable/my_stacked_background</item>
</style>

这篇关于更改动作条的标签背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆