Android – style the actionbarsherlock tab

So I tried to set the tab of actionbar. I implemented it using actionbar Sherlock library. This is my code:

<style name="Theme.AndroidDevelopers" parent="Theme.Sherlock.Light.ForceOverflow">
                <item name="actionBarTabStyle">@style/CustomActionBarStyle</item>
                <item name="android:actionBarTabStyle">@style/CustomActionBarStyle</item>

            <style name="CustomActionBarStyle" parent="Widget.Sherlock.Light.ActionBar.TabBar">
                <item name="android:background">@drawable/actionbar_tab_bg</item>
            </style>

In the second and third lines, if I change the actionbartabstyle to actionbarstyle, my action bar itself will change to the style I want (not very good, of course), so the connection works normally. However, the attempt to change the action bar tab (below it) still failed

I hope someone can help me

With respect,

resolvent:

The following should be valid

<style name="Theme.app" parent="@style/Theme.Sherlock.Light">
        <item name="android:actionBarTabBarStyle">@style/Theme.app.tabbar.style</item>
        <item name="actionBarTabBarStyle">@style/Widget.app.ActionBar.TabBar</item>
</style>

<style name="Theme.app.tabbar.style" parent="@style/Theme.Sherlock.Light">
    <item name="android:background">#FF0000</item>
    <item name="background">#FF0000</item>
</style>

<style name="Widget.app.ActionBar.TabBar" parent="Widget.Sherlock.ActionBar.TabBar">
    <item name="android:background">#FF0000</item>
    <item name="background">#FF0000</item>
</style>

This makes the tabbar red

You need to set actionbartabbarstyle twice. This is because Android > 3.0 and Android < 3.0

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>