Search code examples
androidswipefragment-tab-host

Using swipe in FragmentTabHost


I have implemented FragmentTabHost in my app and I wanted to use basic Swipe option for the app to make it look interactive. And I have no idea about that implementation.


Solution

    1. Use ViewPager inside your FragmentTabHost
    2. Set an adapter to your created ViewPager defined at inner FragmentTabHost.
    3. Add setOnPageChangeListener into ViewPager that can change fragment on onPageSelected() at every swipe .

    You can go through this complete example.