RecyclerViews

Up to this point, we have been working with very straightforward View elements. Things like TextViews, EditTexts and Buttons are very useful, but interations with them are very simple and straigforward. Now we will be working on making the message display more robust and feature filled.

We will be adding a View element called a RecyclerView. RecyclerViews are useful because they allow us to map any data to a View on the fly. Rather than manually making a list like we did at the end of the last section, a RecyclerView does this automatically. This is especially useful when your list items are very complex and you want to interact with them individually. A RecyclerView solves all of these problems by giving you a handful of methods to implement then doing the rest of the grunt work for you automatically.

Adding a RecyclerView has a few steps.

  1. Add the RecyclerView library
  2. Add the RecyclerView to the XML
  3. Give the RecyclerView a LayoutManager
  4. Create an Adapter to map our data into list items

We will be going into these steps in more detail.

results matching ""

    No results matching ""