Better Programming

Advice for programmers.

Follow publication

Build LazyColumn With a Scrollbar Using Jetpack Compose

There for you when you want an awesome scrolling experience

Bill Tsapalos
Better Programming
Published in
2 min readJun 1, 2022

Photo by Taylor Wilcox on Unsplash

A New Library in Town

There is a new library named LazyColumns that provides variations of a LazyColumn. Let’s say they’re LazyColumns on steroids.

To add it to your project, you should add the following into your project build.gradle or settings.gradle depending the Gradle version your project uses.

Then into the build.gradle of your app module add the following dependency.

How to Use

After adding the library dependency into your project you just have to call the following Composable function, as you can see below:

The parameters used are the same as the parameters used in a regular LazyColumn implementation apart from the settings parameter which affects the look & feel of the scrollbar.

Code Sample

You can see a real-life use case of the above Composable function in the following example:

As I mentioned above, the parameters are really simple (like a regular LazyColumn). Here we render the data list and we give a 500.dp height to our LazyColumn .

The Result

All is good with the code above, but what should someone expect when the code above will be executed?

Need More Code?

In case you want to see what is going on behind the scenes, contribute to this project, or see all of the above in a single project you are free to clone, here’s the link to the official LazyColumns GitHub page.

Bill Tsapalos
Bill Tsapalos

Written by Bill Tsapalos

In love with Android, Kotlin and IoT

Responses (1)

Write a response