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 ...
Get Android Programming: The Big Nerd Ranch Guide, 5th 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.