I've tried to let the SampleTabsStyled demo from the ViewPagerIndicator change the color of the text of the currently selected tab without success.
However, the SampleTitlesStyledTheme demo does change its text color when switching between titles/tabs.
When looking inside the styles xml:
<resources>
...
<style name="CustomTitlePageIndicator">
<item name="android:background">#18FF0000</item>
<item name="footerColor">#FFAA2222</item>
<item name="footerLineHeight">1dp</item>
<item name="footerIndicatorHeight">3dp</item>
<item name="footerIndicatorStyle">underline</item>
<item name="android:textColor">#AA000000</item>
<item name="selectedColor">#FF000000</item>
<item name="selectedBold">true</item>
</style>
...
<style name="CustomTabPageIndicator" parent="Widget.TabPageIndicator">
<item name="android:background">@drawable/custom_tab_indicator</item>
<item name="android:textAppearance">@style/CustomTabPageIndicator.Text</item>
<item name="android:textColor">#FF555555</item>
<item name="android:textSize">16sp</item>
<item name="android:divider">@drawable/custom_tab_indicator_divider</item>
<item name="android:dividerPadding">10dp</item>
<item name="android:showDividers">middle</item>
<item name="android:paddingLeft">8dp</item>
<item name="android:paddingRight">8dp</item>
<item name="android:fadingEdge">horizontal</item>
<item name="android:fadingEdgeLength">8dp</item>
</style>
<style name="CustomTabPageIndicator.Text" parent="android:TextAppearance.Medium">
<item name="android:typeface">monospace</item>
</style>
...
</resources>
I see that the SampleTitlesStyledTheme
demo uses the CustomTitlePageIndicator
style, which defines a selectedColor
item. So (perhaps naively) I thought to add
<item name="selectedColor">#FF000000</item>
to the style the SampleTabsStyled
demo is using, CustomTabPageIndicator
, but, alas, that didn't work.
The question seems obvious, but I'll ask anyway: is there a way (using the present styles xml) to let the currently selected text of a tab in the SampleTabsStyled
demo have a different color than the other tabs? If so, how?
EDIT
Oh, and I'm using this in combination with ActionBarSherlock, in case that is important...
android:textColor
intoandroid:color
in the tab_text_color.xml file after which it worked like a charm. Many thanks Neoh! – Optimal