Chapter 13. Recycler Views and Card Views: Get Recycling

You’ve already seen how the humble list view is a key part of most apps. But compared to some of the material design components we’ve seen, it’s somewhat plain. In this chapter, we’ll introduce you to the recycler view, a more advanced type of list that gives you loads more flexibility and fits in with the material design ethos. You’ll see how to create adapters tailored to your data, and how to completely change the look of your list with just two lines of code. We’ll also show you how to use card views to give your data a 3D material design appearance.

There’s still work to do on the Bits and Pizzas app

In Chapter 12, we updated the Bits and Pizzas app to include components from the Design Support Library, including a tab layout, FAB, and collapsing toolbar. We added these to help users navigate to places in the app more easily, and to implement a consistent material design look and feel. If you recall, material design is inspired by paper and ink, and uses print-based design principles and movement to reflect how real-world objects (such as index cards and pieces of paper) look and behave. But there’s one key area we didn’t look at: lists.

We’re currently using list views in PizzaFragment, PastaFragment, and StoresFragment to display the available pizzas, pasta, and stores. These lists are very plain compared with the rest of ...

Get Head First Android Development, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.