In Android can I implement swipe between tabs functionality using tab-host. Is it possible to use this functionality without fragments. When we are targeting older android versions how can we implement this feature. Can someone help me. Thank You!
Establish the link by creating an instance of this class, make sure the ViewPager2 has an adapter and then call attach() on it. Instantiating a TabLayoutMediator will only create the mediator object, attach() will link the TabLayout and the ViewPager2 together.
The following link should get you started:
http://www.androidhive.info/2013/10/android-tab-layout-with-swipeable-views-1/
It uses view pager and adds views of each tab int it. On tab change listener it changes the view in view pager.
If you are going to use Fragments, go by @vipulmittal answer Or else you want to implement touch listener like SimpleGestureListener based on your requirements. Good example is here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With