How to change the Action bar tab text color

后端 未结 2 1313
渐次进展
渐次进展 2020-12-12 01:07

I need to change the Action bar tab text color.So far Action bar tab text color displayed in black.But I need to change it into white color.

Manifest:

相关标签:
2条回答
  • 2020-12-12 01:58

    Declare this in your AppTheme:

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

    Then here is the style declaration:

    <style name="tabtextcolor" parent="@android:style/Widget.Holo.Light.ActionBar.TabText">
        <item name="android:textColor">@android:color/white</item>
    </style>
    
    0 讨论(0)
  • 2020-12-12 02:05

    Use this in our theme to set the actionbar text color:

    <item name="titleTextStyle">@style/ActionBar.CustomTitle</item>
    
    <!-- ActionBar title text -->
        <style name="ActionBar.CustomTitle" parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title">
            <item name="android:textColor">@color/title_detail_color</item>
            <!-- The textColor property is backward compatible with the Support Library -->
        </style>
    

    Sorry, this is for the case you are using AppCompat support library.

    You could use the general:

    <!-- ActionBar title text -->
        <style name="ActionBar.CustomTitle"
               parent="@style/TextAppearance.Holo.Widget.ActionBar.Title">
            <item name="android:textColor">@color/title_detail_color</item>
        </style>
    

    Also, instead of Holo, you could try some other themes that match your current theme. You can also read more on the official documentation: https://developer.android.com/training/basics/actionbar/styling.html

    0 讨论(0)
提交回复
热议问题