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

Added ability to display any view inside a tab for both the content and the background. #32

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

Benjamin-Dobell
Copy link

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.

Benjamin Dobell added 4 commits August 6, 2013 09:49
…brary with a reference to one in the Android support library repository.
… 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. This is obviously very flexible but the original motivation was to support custom ImageView subclasses that download images from the Internet.
- 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.
…ing to ensure the indicator is always on top.
@Benjamin-Dobell
Copy link
Author

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).

Benjamin Dobell added 2 commits September 12, 2013 17:27
…aces and hence caused attribute name collisions with the official Android app compatibility library.
@ghost ghost assigned astuetz Sep 17, 2013
@clocksmith
Copy link

What is the status of this pull request? I want this feature badly.

@Benjamin-Dobell
Copy link
Author

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.

@ghost
Copy link

ghost commented Jan 18, 2014

@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

@iam1492
Copy link

iam1492 commented Jan 31, 2014

@Benjamin-Dobell Wanna this feature~~!!! Thanks~

@ericlw
Copy link

ericlw commented Feb 12, 2014

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

@Benjamin-Dobell
Copy link
Author

@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.

@austynmahoney
Copy link

👍 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?

silentnuke-old added a commit to silentnuke-old/PagerSlidingTabStriptest that referenced this pull request Jun 27, 2014
@arthurprs
Copy link

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.

screenshot from 2014-07-08 20 04 20

@clocksmith
Copy link

is the TabCustomViewProvider ever going to be merged in?

@shakmak
Copy link

shakmak commented Aug 20, 2014

I am also waiting for these new features to be merged. Till then i am using Benjamin-Dobell repo.
Thanks

@dawkinsjeff
Copy link

Hello, How to add view from xml in ContactPagerAdapter?

@noni-mizu
Copy link

Really bummed TabCustomViewProvider is not merged in. I spent hours switching my sliding tabs to this. :(

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.

None yet

10 participants