Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make updateTabStyles() callable from CustomTabProvider (fixes #68). #79

Closed
wants to merge 1 commit into from
Closed

Conversation

Nutomic
Copy link

@Nutomic Nutomic commented Mar 3, 2015

This lets me have the default tab style, and make changes to it without re-implementing everything.

Here's my getCustomTabView() implementation (I pass the PagerSlidingTabStrip to my PagerAdapter in the constructor):
@OverRide
public View getCustomTabView(ViewGroup viewGroup, int i) {
TextView tv = (TextView) LayoutInflater.from(mContext).inflate(R.layout.psts_tab, viewGroup, false);
mTabStrip.updateTabStyle(tv);
tv.setText(getPageTitle(i));
// apply my costumizations

    // HACK: Remove ID so text color is not changed on tab switch.
    tv.setId(0);
    return tv;
}

As you see, this isn't quite perfect because of the hack I need, but it works for me. I'm open for any improvements ;)

@jpardogo
Copy link
Owner

Thanks for the PR I will review it asap

@jpardogo
Copy link
Owner

I added a new solution to #68, let me know what you think. I think this one is hacky I would prefer to find another way but many thanks for the PR

@jpardogo jpardogo closed this May 15, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants