Jetpack Compose: Lists
The two ways we can implement Lists in Jetpack Compose.
Note: I’m using Jetpack Compose version 0.1.0-dev08 at the time of writing this.
Using AdapterList
We can use AdapterList composable — it is equivalent to RecyclerViews + RecyclerViewAdapters — but with significantly less code 😍
AdapterList constructor takes in data, which is a list of items you want to display and passes individual items to a lambda. There you can define the list item.
Get Ahmed Rizwan’s stories in your inbox
Join Medium for free to get updates from this writer.
Currently it’s limited to vertical scrolling only. This might change in future releases.
Multiple Types
We can easily differentiate between different view types — by simply adding if conditions. Here’s an example if we want to show a heading at the start of the list:
Using Vertical and Horizontal Scrollers
Another way of implementing lists is using simple Scrollers — these won’t use recycled views. So not really ideal for large lists.
We can nest these scrollers to construct the layout using Columns & Rows.
Here’s the layout in action:
Disclaimer: As the Jetpack Compose is in development phase — any of these APIs can change at any time. So as the source of truth, please always refer to the official documentation.
Previously I also covered other composable layouts— be sure to check those out as well:
That’s it for now, thanks for reading — I’ll be covering more things related to Jetpack Compose soon so stay tuned. Happy coding!










