Android Programming: The Big Nerd Ranch Guide, 5th Edition
by Bryan Sills, Brian Gardner, Kristin Marsicano, Chris Stewart
Scrollable Lists with LazyColumn
The last step in the major scaffolding for Coda Pizza is to turn your ToppingsList composable into, well, a list. Right now it displays a single topping, but you want it to show all the available toppings in Coda Pizza’s menu. Previously, you would use RecyclerView to achieve this goal, which generally involves a ritual of creating an adapter, view holder, and layout manager for even the most basic of lists.
In Compose, scrollable lists of items are created using LazyColumn (or LazyRow, if you want to scroll horizontally instead of vertically). At a very high level, LazyColumn behaves like RecyclerView: It only does work for the composables that will be drawn onscreen, and it can scroll through ...
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