When creating a RecyclerView in Android Studio, it can be helpful to add sample data to the RecyclerView to help with debugging. By default, the following is shown in the Preview and Design Layout Editor tab.
With only a little work, we can convert this RecyclerView to the following. Isn’t that more helpful? Now you can see how the images and text shows up, right in the editor!
Let’s assume you already have your layout files for the RecyclerView.
With a little modification, we can display an avatar and random last name. We can add one line to each file. First, let’s modify the RecyclerView in the first file, the content_main.xml file, by adding the following:
Then let’s modify user_row.xml. Add this to the ImageView:
While still in user_row.xml, let’s add a random last name to the TextView:
Now run the project, and see what we’ve created!
For further development, see this page on the Android Developer’s website.