I'm trying to style the new TabLayout
from android design library.
<style name="NavigationTab" parent="Widget.Design.TabLayout">
<item name="tabBackground">@drawable/background_tab</item>
<item name="tabIndicatorColor">@color/blue</item>
<item name="tabTextAppearance">@style/NavigationTabTextAppeareance</item>
</style>
And the text is defined right here
<style name="NavigationTabTextAppeareance" parent="TextAppearance.Design.Tab">
<item name="android:textColor">@color/primary_light</item>
<item name="android:textSize">12sp</item>
</style>
But the selected tab is always black, how can I change it?
Right-click the worksheet tab whose color you want to change. Choose Tab Color, and then select the color you want. The color of the tab changes, but not the color of the font. When you choose a dark tab color, the font switches to white, and when you choose a light color for the tab, the font switches to black.
set tabSelectedTextColor in NavigationTab like this:
<style name="NavigationTab" parent="Widget.Design.TabLayout">
<item name="tabBackground">@drawable/background_tab</item>
<item name="tabSelectedTextColor">@color/primary_light</item>
<item name="tabIndicatorColor">@color/blue</item>
<item name="tabTextAppearance">@style/NavigationTabTextAppeareance</item>
</style>
<style name="NavigationTabTextAppeareance" parent="TextAppearance.Design.Tab">
<item name="android:textColor">@color/primary_light</item>
<item name="android:textSize">12sp</item>
</style>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With