我设置了带有标签导航的操作栏。在较小的屏幕上,选项卡位于操作栏下方,而在较大的屏幕上,选项卡位于操作栏内。我的操作栏是红色的,标签是黑色的。When the tabs are below the action bar I would like the selector to be colored red and then change the color to black if the tabs are inside the action bar.
我的问题是我要么在操作栏下方和内部得到一个红色选择器,要么在操作栏下方和内部得到一个黑色选择器。When the tabs are below the actionbar I would like the selector to be red and when they are inside I would like the selector to be black. 这是我的styles_actionbar.xml:
<style name="Theme.customabthemegenerated" parent="@android:Theme.Holo.Light">
<item name="android:actionBarItemBackground">@drawable/selectable_background_customabthemegenerated</item>
<item name="android:actionBarStyle">@style/solid_ActionBar</item>
<item name="android:actionBarTabStyle">@style/ActionBarTabStyle</item>
<item name="android:actionBarTabBarStyle">@style/ActionBarTabBarStyle</item>
<item name="android:actionBarTabTextStyle">@style/ActionBarText</item>
</style>
<style name="solid_ActionBar" parent="@android:Widget.Holo.Light.ActionBar.Solid">
<item name="android:background">@drawable/ab_solid_customabthemegenerated</item>
<item name="android:backgroundStacked">@drawable/ab_stacked_solid_customabthemegenerated</item>
<item name="android:backgroundSplit">@drawable/ab_bottom_solid_customabthemegenerated</item><!-- No difference without it -->
</style>
<style name="ActionBarTabStyle" parent="@android:style/Widget.Holo.ActionBar.TabView">
<item name="android:background">@drawable/tab_indicator_inside</item>
</style>
<style name="ActionBarTabBarStyle" parent="@android:style/Widget.Holo.ActionBar.TabBar">
<item name="android:background">@drawable/tab_indicator_outside</item>
</style>
<style name="ActionBarText" parent="@android:style/TextAppearance">
<item name="android:textColor">@color/white</item>
</style>
我认为 ActionBarTabBarStyle 会在选项卡位于操作栏之外时设置它们的样式,但它似乎没有效果。有没有办法在操作栏拆分时获得红色选择器,在操作栏堆叠时获得黑色选择器?