jpardogo / PagerSlidingTabStrip

An interactive indicator to navigate between the different pages of a ViewPager
2.19k stars 354 forks source link

Indicating press state on not activated tab #56

Closed RustamG closed 9 years ago

RustamG commented 9 years ago

Hello!

In google play app when you press tab that is not activated its text color becomes like in activated tab. Could you make the same behavior in your library?

Thanks for your work!

jpardogo commented 9 years ago

You can do that in the library applying a selector to android:textColor https://github.com/jpardogo/PagerSlidingTabStrip/blob/master/library/src/com/astuetz/PagerSlidingTabStrip.java#L162

RustamG commented 9 years ago

Suppose I need to have red text color of the selected tab and other tabs should have black colors. When I press non-selected tab I want the pressed tab's text color to become red while touch is not released. As I understood now library uses the same color for selected and not selected tabs. For non-selected tabs it simply applies alpha. Am I right?

jpardogo commented 9 years ago

I think, you can work with ColorStateList for the textColor to achieve this.You can apply it either form xml or dynamically. Did you try? I think I did something similar already with this library. I reopen the issue because I don't remember well the behaviour.

RustamG commented 9 years ago

If I set ColorStateList with identical color for both default state and pressed states it does not solve the requirement. I guess it's because not selected tab titles have the same color as selected but alpha < 1 applied to them using ViewCompat.setAlpha(). So when the title color is black for selected tab, the rest tabs have grey colors.

I'll make pull request when I get to polishing design stage in my project.

Thank you.

jpardogo commented 9 years ago

Yes, I see. You can have different colors for pressed state:

<item android:state_pressed="true" android:color="@color/other_color"/>

But selected and not selected tabs will just vary on alpha. I leave the issue open. Cheers.

jpardogo commented 9 years ago

Fix for next release v1.0.9