In this article, you’ll learn how to create scrollable lists in JetPack Compose. Compose recently moved from the dev to alpha stage, so we’ll be discussing a different implementation than in my previous JetPack Compose articles about lists. Stick to the end to learn about new Compose components.

Introduction

In our usual Android UI design, aka XML layouts, we have widgets like RecyclerView to effectively display large data sets. I would agree that RecyclerView has solved many pain points, but the problem is having so much boilerplate code.

We need to override a bunch of functions —onCreateViewHolderonBindViewHoldergetItemCount, etc. In those functions, we need to write the same template of code all the time. In addition to if you need any extra features, we need to implement them by ourselves. I agree it’s for the best performance, but it’s too much to do.

This is where I think JetPack Compose shines. Building declarative UI keeps the developers’ context to the same programming language (Kotlin) and reduces the boilerplate code.

Scrollable Compose Components

So today’s topic is scrollable components in JetPack Compose. Compose provides a couple of ways to show vertical or horizontal lists.

Note: Jetpack Compose is an actively developing framework. Each day, hundreds of brilliant minds from Google work on it. The code we’re using in this article may change with the updates.

#jetpack-compose #kotlin #mobile #android

Jetpack Compose: Scrollable Components
1.95 GEEK