Android Programming: The Big Nerd Ranch Guide, 5th Edition
by Bryan Sills, Brian Gardner, Kristin Marsicano, Chris Stewart
Implementing a LayoutManager
RecyclerView is a view with a narrow focus, and on its own it does not do much. All it does is “recycle,” or reuse, views to display a list of data. It delegates all the other responsibilities of displaying that list of data to other components: LayoutManager, ViewHolder, and Adapter. We will walk you through these pieces one at a time.
The RecyclerView delegates the responsibility for positioning items on the screen to the LayoutManager. The LayoutManager positions each item and also defines how scrolling works. So if RecyclerView wants to display items but the LayoutManager is not there, it will give up and display nothing.
There are a few built-in LayoutManagers to choose from, and you can find more ...
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