PagerSlidingTabStrip
PagerSlidingTabStrip copied to clipboard
Added ability to display any view inside a tab for both the content and the background.
Tab appearances are now much more flexible with the ability to display any View as the content and/or background for a tab:
- IconTabProvider has been replaced by TabCustomViewProvider, which allows you to place any view at all inside a tab.
- Added TabBackgroundProvider which allows each tab to set any View as a background for a tab.
- Indicator and divider drawing has been moved from onDraw() to dispatchDraw() in order to enforce drawing over subviews, rather than behind them.
- The current tab now has its selection state set, which again makes for more visual flexibility.
- Sample has been updated to demonstrate new functionality.
The changes made obviously offer a great deal of flexibility but the original motivation was to support images downloaded from the Internet (rather than using resources) for both the background and content.
Although not originally my intention, this pull request resolves #17, resolves #18, does something similar to #20, implements similar functionality to #28 (but is slightly cleaner as I'm not messing with state in onDraw) and does half of #29 (i.e. update support library).
What is the status of this pull request? I want this feature badly.
clocksmith, the fork is stable and has been used in several production apps for many months. So feel free to pull from the fork directly.
@Benjamin-Dobell can you please update your pull request to the current dev branch? Would love to add this functionality to version 1.1.0
@Benjamin-Dobell Wanna this feature~~!!! Thanks~
This one is much better than the main repo. Now I was wondering how do I highlight the current tab when using a getPageTabCustomView ? I want my current tab to be a certain tint, but with this all of the tabs are the same tint. The underline makes it easy to see which tab is selected though
@ericlw In my fork, the sample actually shows this behaviour off.
https://github.com/Benjamin-Dobell/PagerSlidingTabStrip/blob/master/sample/src/com/astuetz/viewpager/extensions/sample/QuickContactFragment.java
Take a look at createBackground() where the StateListDrawable is created. In the fork the current tab is automatically set to be "selected", so you can define a different Drawable for android.R.attr.state_selected.
@astuetz I'm sorry that it doesn't merge at the moment. Although, to be fair it did merge cleanly at the time I made the pull request ;) Anyway, I don't want to divert the user-base from the main repo, so when I get a chance I will get this ready to merge again.
:+1: for updating it to be ready to merge.
@Benjamin-Dobell What conflicts are you running into? Is there anything we can do to help you?
I had some problems with shouldExpand in 4.4 (not tested in others). The tabs wouldn't expand when created, but for some reason when recreated they did expand correctly. Spend half a day trying to find the issue but no luck.

is the TabCustomViewProvider ever going to be merged in?
I am also waiting for these new features to be merged. Till then i am using Benjamin-Dobell repo. Thanks
Hello, How to add view from xml in ContactPagerAdapter?
Really bummed TabCustomViewProvider is not merged in. I spent hours switching my sliding tabs to this. :(