Chapter 20. Paging and Swiping
Paging is the act of moving from page to page, and on Android, we do this by swiping a finger across the screen. The current page transitions in a direction and speed to match the finger movement. It is a useful and practical way to navigate around an app, but perhaps even more than this, it is an extremely satisfying visual effect for the user. Also, as with ListView
, we can selectively load just the data required for the current page, and perhaps the data for the previous and next pages.
In the next screenshot, you can see the calendar app on the Nexus 5 emulator paging between months. Be sure to launch an emulator and give it a try if you are unsure how paging and swiping works:
In the next figure, we can see the famous Angry Birds level-selection menu showing swiping/paging in action:
The Android API, as you would have come to expect by now, has some solutions through which you can achieve paging in a quite simple manner.
In this chapter, you will...