我使用的福尔摩斯库的动作条的工作。我想改变的动作条和标签的背景图像不同。目前,我已经改变了动作条的背景下,通过成功codeS在运行时:
I am working on Actionbar using Sherlock library. I want to change the Background Image of the Actionbar and Tabs differently. Currently I have changed the Background of the Actionbar successfully via codes at runtime:
Drawable myIcon = getResources().getDrawable(R.drawable.blue_menu_background);
mActionBar.setBackgroundDrawable(myIcon);
但我得到的问题与选项卡的背景。如何更改标签的背景。请给我建议。
But I am getting problem with the Tab background. How can I change the Background of Tabs. Please suggest me.
而不是这样做的,你可以使用样式的标签:
Instead of doing that, you can use Style for Tabs:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- the theme applied to the application or activity -->
<style name="CustomActivityTheme" parent="@android:style/Theme.Holo">
<item name="android:actionBarTabTextStyle">@style/CustomTabTextStyle</item>
<item name="android:actionBarDivider">@drawable/ab_divider</item>
<item name="android:actionBarItemBackground">@drawable/ab_item_background</item>
</style>
<!-- style for the action bar tab text -->
<style name="CustomTabTextStyle" parent="@android:style/TextAppearance.Holo">
<item name="android:textColor">#2456c2</item>
</style>
</resources>
检查这文章更多细节。