我正在尝试自定义 ActionBarSherlock 中的导航选项卡。如果我只是为导航选项卡设置背景,则选项卡的现有文本样式将丢失。文本缩小并在选项卡内左对齐。我的理解是我正在设置一个属性,它被合并到父主题中。它似乎完全取代了父主题。我是否必须设置所有属性才能在导航选项卡中自定义一件事?
这是代码:
/res/values/themes.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MyTheme" parent="Theme.Sherlock.Light">
<item name="android:dither">true</item>
<item name="android:actionBarTabStyle">@style/MyActionBarStyle</item>
<item name="actionBarTabStyle">@style/MyActionBarStyle</item>
</style>
<style name="MyActionBarStyle" parent="Widget.Sherlock.Light.ActionBar.TabBar">
<item name="android:background">@drawable/my_new_bg</item>
</style>
</resources>
androidmanifest.xml:
...
<application
android:name=".MyApplication"
android:hardwareAccelerated="true"
android:icon="@drawable/app_icon"
android:label="@string/app_name"
android:description="@string/app_desc"
android:theme="@style/MyTheme" >
...