Nesting tabs in Android 4 with support library (ActionBarSherlock)
PagerAdapter
does not require Fragments
as children. You can inflate/manage your own custom views in there. So you could continue to use nested TabActivities
. Or, you could put Fragments
at the top-level, and manage your own Views
in the bottom-level ViewPager
.
You could also, theoretically, use ViewFlipper
if you want to keep the Fragments in the ViewPager
. You'll have to write your own LinearLayout
with Buttons
as tabs, but this is easy. If you're looking for the Holo look, simply set the style to the ones found in ABS.
Another option is to use TabHost
without using the TabActivity
. You can even use it with Fragments. See the example here.
Also note: If you're looking for the Google Play style of ViewPagerIndicator, thats now inlcuded in the Support package: PagerTitleStrip.
I'd imagine that your best option is to use Fragments as the top-level, as this will help with memory consumption.
That said,
I must say that this sounds like a terrible UI pattern. Even worse, we are talking about a lot of inflated views in one Activity
. You may run into memory issues here, depending on whats being shown. I suggest heavy usage of ViewStubs
and recycling if you keep the ViewPager
at the bottom.
Keep trying to push the client toward using the ActionBar spinner pattern for top-level (main 3 tabs), or even consider the fancy sliding drawer pattern. Perhaps that smooth animation could be enough to sway their opinion.
Refer them to the official design website, and show examples of popular navigation patterns like the ones found in Gmail, YouTube, Google+, Evernote, etc. I recently dealt with a client requesting the exact-same pattern you describe, and after weeks of pushing was able to convince them that more-than` 2 layers of tabs is unacceptable.
You can also show them my Wall of Shame Google+ page, highlighting bad design patterns used in popular Android apps: Android UI Anti-Patterns. :-)