Actionbarsherlock - 改变动作条线的颜色颜色、动作、Actionbarsherlock

2023-09-04 23:26:01 作者:煙不離手

我目前正在做与pre 3.0设备与actionbarsherlock的帮助我的应用程序兼容。我的应用程序有一个自定义主题,超越控制Holo.light改变蓝色橙色。

I am currently working on making my application compatible with pre 3.0 devices with the aid of actionbarsherlock. My application has a custom theme which overide Holo.light changing the blue to orange.

我想改变屏幕上出现的动作条为橙色在蓝线。随着官方的动作条我管理这个通过重写

I am wanting to change the blue line which appears under the actionbar to orange. With the official actionbar I managed this by overriding

    <item name="android:background">@drawable/ad_tab_unselected_holo</item>

不幸的是这似乎没有在actionbarsherlock是工作4。

Unfortunately this does not seem to be working in actionbarsherlock 4.

推荐答案

您需要做两件事情:

ABS的4现在模仿其属性的标准操作栏,所以你需要为添加 -

The ABS 4 now mimics the standard Action bar with its attributes so you need to add -

<item name="background">@drawable/ad_tab_unselected_holo</item>

请注意,没有机器人:

所以,你的整体code将是:

So your overall code would be:

<item name="android:background">@drawable/ad_tab_unselected_holo</item>
<item name="background">@drawable/ad_tab_unselected_holo</item>

要报价:

由于Android的主题化系统中的任何主题的限制   自定义必须在两个属性来声明。正常   android- prefixed属性应用主题本机操作栏   和pfixed联合国$ P $属性的自定义实现。以来   这两个主题化的API是完全一样的,你只需要参考您   自定义,而不是两次不必实现他们两次。

Due to limitations in Android's theming system any theme customizations must be declared in two attributes. The normal android-prefixed attributes apply the theme to the native action bar and the unprefixed attributes are for the custom implementation. Since both theming APIs are exactly the same you need only reference your customizations twice rather than having to implement them twice.

我也将延长的变体光盘 Theme.Sherlock 而不是全息,因为我相信全息不适用于旧设备是pre 3.0。

I would also extend a varient of Theme.Sherlock rather than holo, as I believe holo is not available on older devices that are pre 3.0.