Using Swipe Views to swop pages
Swipe views allow you to change pages by swiping your finger across the screen.
You create Swipe views by using a page viewer and an adapter. The adapter supplies the pages and the page viewer takes care of moving the pages on and off the screen.
We’re using a ViewPager. It’s a layout manager that takes care of the horizontal scrolling. Usually it’s used with fragments, scrolling them on and off screen.
We’re also going to need a page adapter to supply the pages to the ViewPager.
As we’re using fragments, we have two adapter options:
We’re going to use the FragmentStatePagerAdapter.
Using Tab navigation in your apps
Tab buttons are displayed in the Action Bar. You can also use images instead of buttons or even your own custom views.
Tabs are designed to work with fragments. Use them to swop fragments in your activities.
We’ll show you how to use Tabs to swop fragments in your activity.