- My question is in my activity or fragment, there are
TabLayout
and ViewPager. If I was to disable swipe ofViewPager
by using a class called NonSwipeableViewPager. Then why should I bother to usingViewPager
right from the start, I could have just useTabLayout
to add tabs which is much more simpler. - What are the other advantages of using
ViewPager
even though the primary function of it which is Creating Swipe Views with Tabs is not needed? - Do
Fragment
layout must use framelayout? Which means can I use relative or liner layout instead of framelayout? - Last but not least, do I allowed to use
ViewPager
with the swipe disabled?
Asked
Active
Viewed 29 times
0

Community
- 1
- 1

Lotto Kuma
- 38
- 5
-
how do you display your content? – tachyonflux Oct 28 '15 at 03:33
-
@karaokyo In an activity, there are toolbar at top, viewpager at middle, and tablayout at bottom. – Lotto Kuma Oct 28 '15 at 03:38
-
right, so how are you planning on displaying it without the view pager? – tachyonflux Oct 28 '15 at 03:47
-
I've found that if you don't want the swipe functionality that it's better to use a frame layout and do the fragment transactions yourself. I created a tab manager class in order to keep it encapsulated. It's only a little bit more code than you would have in a fragment pager adapter. – Daniel Nugent Oct 28 '15 at 04:00
-
you also miss out on the tab swap animation if you do a fragment replace – tachyonflux Oct 28 '15 at 04:12
-
@karaokyo Actually if not using ViewPage I will create a framelayout to show the fragment – Lotto Kuma Oct 28 '15 at 04:16
-
@DanielNugent Can I continue using ViewPager even if I disable the swipe? – Lotto Kuma Oct 28 '15 at 04:19