如何更改ActionBarSherlock的选项卡文本颜色?

时间:2013-09-19 20:21:50

标签: android android-layout android-actionbar actionbarsherlock

我尝试了多种不同的方法将标签文本颜色更改为actionbarshelock为白色,但它根本不起作用。这是我的styles.xml文件。

<style name="Theme.Test" parent="@style/Theme.Sherlock.Light">
    <item name="actionBarItemBackground">@drawable/selectable_background_test</item>
    <item name="popupMenuStyle">@style/PopupMenu.Test</item>
    <item name="dropDownListViewStyle">@style/DropDownListView.Test</item>
    <item name="actionBarTabStyle">@style/ActionBarTabStyle.Test</item>
    <item name="actionDropDownStyle">@style/DropDownNav.Test</item>
    <item name="actionBarStyle">@style/ActionBar.Solid.Test</item>
    <item name="actionModeBackground">@drawable/cab_background_top_test</item>
    <item name="actionModeSplitBackground">@drawable/cab_background_bottom_test</item>
    <item name="actionModeCloseButtonStyle">@style/ActionButton.CloseMode.Test</item>


    <item name="android:actionBarItemBackground">@drawable/selectable_background_test</item>
    <item name="android:popupMenuStyle">@style/PopupMenu.Test</item>
    <item name="android:dropDownListViewStyle">@style/DropDownListView.Test</item>
    <item name="android:actionBarTabStyle">@style/ActionBarTabStyle.Test</item>
    <item name="android:actionDropDownStyle">@style/DropDownNav.Test</item>
    <item name="android:actionBarStyle">@style/ActionBar.Solid.Test</item>
    <item name="android:actionModeBackground">@drawable/cab_background_top_test</item>
    <item name="android:actionModeSplitBackground">@drawable/cab_background_bottom_test</item>
    <item name="android:actionModeCloseButtonStyle">@style/ActionButton.CloseMode.Test</item>
</style>

<style name="ActionBar.Solid.Test" parent="@style/Widget.Sherlock.Light.ActionBar.Solid">
    <item name="background">@drawable/ab_solid_test</item>
    <item name="backgroundStacked">@drawable/ab_stacked_solid_test</item>
    <item name="backgroundSplit">@drawable/ab_bottom_solid_test</item>
    <item name="progressBarStyle">@style/ProgressBar.Test</item>

    <item name="android:background">@drawable/ab_solid_test</item>
    <item name="android:backgroundStacked">@drawable/ab_stacked_solid_test</item>
    <item name="android:backgroundSplit">@drawable/ab_bottom_solid_test</item>
    <item name="android:progressBarStyle">@style/ProgressBar.Test</item>


    <item name="android:titleTextStyle">@style/Test.ActionBar.TitleTextStyle</item>
    <item name="titleTextStyle">@style/Test.ActionBar.TitleTextStyle</item>

    <item name="actionBarTabTextStyle">@style/MyTabTextStyle</item>
    <item name="android:actionBarTabTextStyle">@style/MyTabTextStyle</item>

    <item name="android:actionBarStyle">@style/YOURTHEME.ActionBarStyle</item>
    <item name="actionBarStyle">@style/YOURTHEME.ActionBarStyle</item>
</style>

<style name="YOURTHEME.ActionBarStyle" parent="Widget.Sherlock.Light.ActionBar">
    <item name="android:titleTextStyle">@style/YOURTHEME.ActionBar.TitleTextStyle</item>
    <item name="titleTextStyle">@style/YOURTHEME.ActionBar.TitleTextStyle</item>
</style>

<style name="YOURTHEME.ActionBar.TitleTextStyle" parent="TextAppearance.Sherlock.Widget.ActionBar.Title">
    <item name="android:textColor">@color/white</item>
</style>

<style name="MyTabTextStyle" parent="style/Widget.Sherlock.Light.ActionBar.TabText">
    <item name="android:textColor">@color/white</item>
    <item name="android:background">@color/white</item>
</style>

<style name="Test.ActionBar.TitleTextStyle" parent="TextAppearance.Sherlock.Widget.ActionBar.Title">
    <item name="android:textColor">@color/white</item>
</style>

<style name="ActionBar.Transparent.Test" parent="@style/Widget.Sherlock.Light.ActionBar">
    <item name="background">@drawable/ab_transparent_test</item>
    <item name="progressBarStyle">@style/ProgressBar.Test</item>


    <item name="android:background">@drawable/ab_transparent_test</item>
    <item name="android:progressBarStyle">@style/ProgressBar.Test</item>
</style>

<style name="PopupMenu.Test" parent="@style/Widget.Sherlock.Light.ListPopupWindow"> 
    <item name="android:popupBackground">@drawable/menu_dropdown_panel_test</item>  
</style>

<style name="DropDownListView.Test" parent="@style/Widget.Sherlock.Light.ListView.DropDown">
    <item name="android:listSelector">@drawable/selectable_background_test</item>
</style>

<style name="ActionBarTabStyle.Test" parent="@style/Widget.Sherlock.Light.ActionBar.TabView">
    <item name="android:background">@drawable/tab_indicator_ab_test</item>
</style>

<style name="DropDownNav.Test" parent="@style/Widget.Sherlock.Light.Spinner.DropDown.ActionBar">
    <item name="android:background">@drawable/spinner_background_ab_test</item>
    <item name="android:popupBackground">@drawable/menu_dropdown_panel_test</item>
    <item name="android:dropDownSelector">@drawable/selectable_background_test</item>
</style>

<style name="ProgressBar.Test" parent="@style/Widget.Sherlock.Light.ProgressBar.Horizontal">
    <item name="android:progressDrawable">@drawable/progress_horizontal_test</item>
</style>

<style name="ActionButton.CloseMode.Test" parent="@style/Widget.Sherlock.Light.ActionButton.CloseMode">
    <item name="android:background">@drawable/btn_cab_done_test</item>
</style>

<!-- this style is only referenced in a Light.DarkActionBar based theme -->
<style name="Theme.Test.Widget" parent="@style/Theme.Sherlock">
    <item name="popupMenuStyle">@style/PopupMenu.Test</item>
    <item name="dropDownListViewStyle">@style/DropDownListView.Test</item>

    <item name="android:popupMenuStyle">@style/PopupMenu.Test</item>
    <item name="android:dropDownListViewStyle">@style/DropDownListView.Test</item>
</style>

我想让我的文字颜色变白,但我不知道如何做到这一点。如果有人能帮助我,我会很感激。

谢谢!

1 个答案:

答案 0 :(得分:4)

我得到了它的工作。

这应该是主题

<item name="actionBarTabTextStyle">@style/tabtextcolor</item>
<item name="android:actionBarTabTextStyle">@style/tabtextcolor</item>

这应该是您定义标签文本颜色的位置。

<style name="tabtextcolor" parent="@style/Widget.Sherlock.ActionBar.TabText">
    <item name="android:textColor">@android:color/white</item>
</style>