Search code examples
androidandroid-fragmentstabsandroid-viewpagerandroid-tabhost

Nested tabs with viewpager swiping in android?


I've implemented nested tabs with view pager with no problems, but my problem is on the swiping part,

When I do the swiping action the main activity tabs will be switched, but I want the fragment to swipe instead. how can I achieve this?

I've tried implement main tab with tab host and fragment tabhost which doesn't have swiping feature at all, but that disabled whole swipe on the main and fragment together. Description


Solution

  • Instead of custom library you can try to use Bottom navigation view for bottom bar which has been added to version 25 of the Design Support Library. Here is an Article about it.

    So android.support.design.widget.BottomNavigationViewin your activity together with android.support.design.widget.TabLayout and ViewPagerin fragment should work the way you want it to work. And this will also provide good UX (similar to one implemented in Google Plus App)