Reputation: 1266
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.
Upvotes: 13
Views: 1880
Reputation: 33
I made a sample project with nested tab and fragment. may be it might help what is you looking for.
following link to download: NestedTabWithFragment
Upvotes: 1
Reputation: 5087
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.BottomNavigationView
in your activity together with android.support.design.widget.TabLayout
and ViewPager
in 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)
Upvotes: 5
Reputation: 348
I feel like it is wise to follow the Google Material guidelines. Not sure if you checked it out already...
Either way, here is what Google considers best practice for lateral navigation between tabs. Hope it helps!
Upvotes: 1
Reputation: 1595
You can disable view pager swiping on a particular ViewPager
.
But I would suggest to not make 2 ViewPagers on the same screen.
Your bottom TabLayout and corresponding ViewPager can be replaced with BottomBar library.
Upvotes: 1
Reputation: 756
hello shaheen zahedi maybe it's possible please..with..below just set bottom tab changed listener like..
btnTab.setTabChangeListener(null);
Upvotes: 3