Closed rafaeltoledo closed 9 years ago
Could you post you xml layout? If you are changing or defining anything dynamically, could you post it as well? Does the sample display for you the correct textPrimaryColor
by default?
That's my layout element
<com.astuetz.PagerSlidingTabStrip
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:textColor="@android:color/white"
app:pstsIndicatorColor="@android:color/white" />
and my theme
<style name="ParaPesquisa.Theme.Gray" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Different shades of gray -->
<item name="colorPrimary">@color/action_bar</item>
<item name="colorPrimaryDark">@color/color_5</item>
<item name="colorAccent">@color/color_3</item>
</style>
My guess is Theme.AppCompat.Light
has dark primary text color, given than you didn't set pstsTextColorSelected
attribute, this library will use that primary color. android:textColor
just sets inactive tabs' color. So quick fix is you should set pstsTextColorSelected
.
Ok, that make sense.
Basically, this is what is happening:
item name="android:textColorPrimary
of your theme is apply to every tab by default. Which make sense if you take a look to the default color distribution.
Also 150 alpha value will be apply to non selected tabs. You can change the alpha value via app:pstsTextAlphaSet
with a range from 0 to 255.android:textColor
of your layout layout will replace textColorPrimary
for all non selected tabs if it is defined.app:pstsTextColorSelected
will replace textColorPrimary
for the selected tab.What is happening to you is...
item name="android:textColorPrimary
by default is black.textColor
If I were you I would define item name="android:textColorPrimary
in my theme to white and remove
android:textColor="@android:color/white"
app:pstsIndicatorColor="@android:color/white"
in your layout.
After upgrading to 1.0.9, I'm experiencing some different behavior with the colors. Running on Lollipop
1.0.8![v1.0.8](https://cloud.githubusercontent.com/assets/2211337/6356848/fdc20086-bc3e-11e4-8cdb-d1e65b2e4fae.png)
1.0.9![v1.0.9](https://cloud.githubusercontent.com/assets/2211337/6356845/f47099a2-bc3e-11e4-82aa-80ff9148c4fe.png)