Creating the Attachment Pager Adapter

The ViewPager class is a special type of Android widget called an adapter view (although some, such as ViewPager, don't actually inherit from AdapterView, it shares much of the concepts). An AdapterView is used when it potentially needs to display more data than will fit on the screen at once, but maintain excellent performance. They do this by maintaining a small selection of widgets that will be displayed on the screen, and an Adapter that will populate the widgets with the data to display. Examples of Adapter widgets are as follows:

  • ListView: A simple vertical scrolling list of similar items, such as phone contacts
  • GridView: A vertical scrolling grid of similar items, such as photos
  • StackView: A three-dimensional ...

Get Hands-On Android UI Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.