Chapter 5. Lists and Grids
In this chapter, we will work with lists and grids. A list or a matrix of elements can be found in almost every app on the market. Knowing how to display a list of elements on Android is something that you learn at a basic level; however, there is a lot to expand on and understand.
It's important to know which patterns we can use here, how to recycle the view, and how to display different kinds of elements with different views in the same list.
With this in mind, we will be able to understand why RecyclerView
is the successor of ListView
, and we will learn how to implement a list with this component. Therefore, we will cover the following in this chapter:
- Starting with lists
- ListView
- The custom adapter
- Recycling views
- Using the ViewHolder pattern
- Introducing RecyclerView
- List, grid, or stack
- Implementation
- OnItemClick