Preparing RecyclerView to Display Images
The current PhotoHolder in PhotoGalleryFragment simply provides TextViews for the RecyclerView’s GridLayoutManager to display. Each TextView displays the caption of a GalleryItem.
To display photos, you are going to update PhotoHolder to provide ImageViews instead. Eventually, each ImageView will display a photo downloaded from the url of a GalleryItem.
Start by creating a new layout file for your gallery items called list_item_gallery.xml. This layout will consist of a single ImageView (Listing 25.1).
Listing 25.1 Gallery item layout (
<?xml version="1.0" encoding="utf-8"?> <ImageView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" ...