Android 12 Developer Preview is here! Try it out, and give us your feedback!

LazyListLayoutInfo

interface LazyListLayoutInfo
androidx.compose.foundation.lazy.LazyListLayoutInfo

Contains useful information about the currently displayed layout state of lazy lists like LazyColumn or LazyRow. For example you can get the list of currently displayed item.

Use LazyListState.layoutInfo to retrieve this

Summary

Properties
abstract Int

The total count of items passed to LazyColumn or LazyRow.

abstract Int

The end offset of the layout's viewport.

abstract Int

The start offset of the layout's viewport.

abstract List<LazyListItemInfo>

The list of LazyListItemInfo representing all the currently visible items.

Properties

totalItemsCount

abstract val totalItemsCount: Int

The total count of items passed to LazyColumn or LazyRow.

viewportEndOffset

abstract val viewportEndOffset: Int

The end offset of the layout's viewport. You can think of it as a maximum offset which would be visible. Usually it is a size of the lazy list container plus a content padding.

You can use it to understand what items from visibleItemsInfo are fully visible.

viewportStartOffset

abstract val viewportStartOffset: Int

The start offset of the layout's viewport. You can think of it as a minimum offset which would be visible. Usually it is 0, but it can be negative if a content padding was applied as the content displayed in the content padding area is still visible.

You can use it to understand what items from visibleItemsInfo are fully visible.

visibleItemsInfo

abstract val visibleItemsInfo: List<LazyListItemInfo>

The list of LazyListItemInfo representing all the currently visible items.