Build apps faster with our new App builder! Check it out →

LazyLayout

Common

Component in Compose Foundation

A layout that only composes and lays out currently needed items. Can be used to build efficient scrollable layouts.

Last updated:

Installation

dependencies {
   implementation("androidx.compose.foundation:foundation:1.8.0-alpha04")
}

Overloads

@ExperimentalFoundationApi
@Composable
fun LazyLayout(
    itemProvider: () -> LazyLayoutItemProvider,
    modifier: Modifier = Modifier,
    prefetchState: LazyLayoutPrefetchState? = null,
    measurePolicy: LazyLayoutMeasureScope.(Constraints) -> MeasureResult
)

Parameters

namedescription
itemProviderlambda producing an item provider containing all the needed info about the items which could be used to compose and measure items as part of [measurePolicy].
modifierto apply on the layout
prefetchStateallows to schedule items for prefetching
measurePolicyMeasure policy which allows to only compose and measure needed items.
by @alexstyl