Android Programming: The Big Nerd Ranch Guide, 5th Edition
by Bryan Sills, Brian Gardner, Kristin Marsicano, Chris Stewart
Displaying Results in RecyclerView
For your last task in this chapter, you will switch to the view layer and get PhotoGalleryFragment’s RecyclerView to display some images.
Start by creating a layout for an individual list item. In the project tool window, right-click the res/layout directory and choose New → Layout Resource File. Name the file list_item_gallery, set the root element to ImageView, and click OK.
Within the layout, update and add a few XML attributes.
The RecyclerView will provide the list item with an appropriate width, so keep the android:layout_width set to match_parent.
But limit the height to 120dp.
That will allow the user to see multiple rows of images within your RecyclerView onscreen at once.
Flickr does ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access