Chapter 15. Recycler Views: Reduce, Reuse, Recycle
Lists of data are a key part of most apps.
And in this chapter, we’ll show you how to create one using a recycler view: a super-flexible way of building a scrollable list. You’ll learn how to create flexible layouts for your list, including text views, checkboxes, and more. You’ll find out how to create adapters that squish your data into the recycler view in whatever way you choose. You’ll discover how to use card views to give your data a 3D material look. Finally, we’ll show you how layout managers can completely change the look of your list with just one or two lines of code. Let’s get recycling…
What the Tasks app currently looks like
In the previous chapter, we built a Tasks app that lets the user enter task records into a Room database. The app displays the list of records as a formatted String, and it looks like this:
We decided to display the task records using a formatted String since it was a relatively quick and basic way of seeing the records that have been added to the database.
The list, however, looks a little bland. So how can we improve it?
We can turn the list into a recycler view
Instead of displaying the list of tasks as a formatted String, we can change it up so that it looks like this:
As you ...
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