Skip to content
This repository has been archived by the owner on Feb 8, 2022. It is now read-only.

Can't change Tabs Title Color in xml or Java Object #22

Closed
Michazzz opened this issue May 12, 2015 · 7 comments
Closed

Can't change Tabs Title Color in xml or Java Object #22

Michazzz opened this issue May 12, 2015 · 7 comments

Comments

@Michazzz
Copy link

Hi!
I need to change tabs titles color from ViewPager xml file or Java object without change color in styles.
How i can do this?

@MarKco
Copy link

MarKco commented May 12, 2015

I managed to do so by implementing my my_tabs.xml and then setting in it android:textColor="@android:color/whatever" and app:pstsTextColorSelected="@color/whichever"
It seems to work, even though it'd be better to be able to change those colors without implementing a custom tab bar.

@Michazzz
Copy link
Author

Ok, thanks for quickly response!

@MarKco
Copy link

MarKco commented May 12, 2015

Also, if you want to change tabs background, you should do this: app:pstsTabBackground="@color/your_color"

@Michazzz
Copy link
Author

Is possible to change TabBackground color via mViewPager.getPagerTitleStrip().setTabBackground(color) ?

@MarKco
Copy link

MarKco commented May 14, 2015

Yes, you can! :-)

@Michazzz
Copy link
Author

So I'm doing something wrong i think because I'm trying to use that method on FragmentStatePagerAdapter inside method setPrimaryItem. In sample you set there a color of image background

@MarKco
Copy link

MarKco commented May 15, 2015

That's where I tried it, and it worked. Did you also put a tabBackgrouns in XML? Could there be a clash of definitions here between XML and java code?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants