Jetpack Compose: How to Disable Scroll in LazyColumn

Working with lists is common in Android app development. Whether it’s a list of shopping items, messages, user profiles or more, lists are a staple of many applications. Jetpack Compose streamlines this with the LazyColumn composable.

However, there are instances where you might want to disable scrolling in a LazyColumn due to design or feature requirements. This blog post will show you how to do just that in Jetpack Compose.

With the newer versions of Jetpack Compose, disabling scrolling on a LazyColumn is quite straightforward. The userScrollEnabled property can be set directly on the LazyColumn.

fun ListItems() {
    val list = (1..100).toList()

    LazyColumn(userScrollEnabled = false) {
        items(list) { item ->
            Text(text = "Item $item", modifier = Modifier.fillMaxWidth())

In this code, we’ve set userScrollEnabled to false on the LazyColumn. This disables the user’s ability to scroll the list.

In this post, we’ve learned how to disable scrolling in a LazyColumn. This can be useful in specific scenarios where you want to control user interaction with your list. Jetpack Compose, with its ever-growing library of composables, continues to make UI development more straightforward and efficient.

However, it’s important to remember that disabling scroll in a LazyColumn could affect user experience if not used properly. Always keep your users’ needs at the forefront of your design decisions, ensuring your UI is intuitive and user-friendly.

Similar Posts

Leave a Reply