astuetz / PagerSlidingTabStrip

An interactive indicator to navigate between the different pages of a ViewPager
139 stars 44 forks source link

Any way to hide/show a tab at runtime? #105

Open ghost opened 10 years ago

ghost commented 10 years ago

Is there any way to hide/show a tab at runtime?

tomxor commented 9 years ago

You can set a flag in the adapter which changes the way getCount(), getItem() and getPageTitle() behave, once modified you have to notify any Observers about the change, and also notify the PagerSlidingTabStrip View explicitly via the notifyDataSetChanged() method.

If it suits your workflow better, you could also use a secondary Adapter.

Another solution would be to find the specific tab View by traversing the PagerSlidingTabStrip ViewGroup hierarchy, but that feels more hacky and might be incompatible in the case of a new release.