androidx.compose.foundation.lazy.layout

Interfaces

IntervalList

The list consisting of multiple intervals.

Cmn
LazyLayoutIntervalContent.Interval

Common content of individual intervals in item DSL of lazy layouts.

Cmn
LazyLayoutItemProvider

Provides all the needed info about the items which could be later composed and displayed as children or LazyLayout.

Cmn
LazyLayoutMeasureScope

The receiver scope of a LazyLayout's measure lambda.

Cmn
LazyLayoutPinnedItemList.PinnedItem

Item pinned in a lazy layout.

Cmn
LazyLayoutPrefetchState.PrefetchHandle
Cmn
LazyLayoutScrollScope

A ScrollScope to allow customization of scroll sessions in LazyLayouts.

Cmn
NestedPrefetchScope

A scope which allows nested prefetches to be requested for the precomposition of a LazyLayout.

Cmn
PrefetchRequest

A request for prefetch which can be submitted to a PrefetchScheduler to execute during idle time.

Cmn
PrefetchRequestScope

Scope for PrefetchRequest.execute, supplying info about how much time it has to execute requests.

Cmn
PrefetchScheduler

Implementations of this interface accept prefetch requests via schedulePrefetch and decide when to execute them in a way that will have minimal impact on user experience, e.g. during frame idle time.

Cmn

Classes

IntervalList.Interval

The interval holder.

Cmn
LazyLayoutIntervalContent

Common parts backing the interval-based content of lazy layout defined through item DSL.

Cmn
LazyLayoutPinnedItemList

Read-only list of pinned items in a lazy layout.

Cmn
LazyLayoutPrefetchState

State for lazy items prefetching, used by lazy layouts to instruct the prefetcher.

Cmn
MutableIntervalList

Mutable version of IntervalList.

Cmn

Top-level functions summary

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

A layout that only composes and lays out currently needed items.

Cmn
Unit
@Composable
LazyLayoutPinnableItem(
    key: Any?,
    index: Int,
    pinnedItemList: LazyLayoutPinnedItemList,
    content: @Composable () -> Unit
)

Wrapper supporting PinnableContainer in lazy layout items.

Cmn
Any

This creates an object meeting following requirements:

Cmn
android

Top-level functions

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

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

Parameters
itemProvider: () -> LazyLayoutItemProvider

lambda 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.

modifier: Modifier = Modifier

to apply on the layout

prefetchState: LazyLayoutPrefetchState? = null

allows to schedule items for prefetching

measurePolicy: LazyLayoutMeasureScope.(Constraints) -> MeasureResult

Measure policy which allows to only compose and measure needed items.

Note: this function is a part of LazyLayout harness that allows for building custom lazy layouts. LazyLayout and all corresponding APIs are still under development and are subject to change.

LazyLayoutPinnableItem

@Composable
fun LazyLayoutPinnableItem(
    key: Any?,
    index: Int,
    pinnedItemList: LazyLayoutPinnedItemList,
    content: @Composable () -> Unit
): Unit

Wrapper supporting PinnableContainer in lazy layout items. Each pinned item is considered important to keep alive even if it would be discarded otherwise.

Parameters
key: Any?

key of the item inside the lazy layout

index: Int

index of the item inside the lazy layout

pinnedItemList: LazyLayoutPinnedItemList

container of currently pinned items

content: @Composable () -> Unit

inner content of this item

Note: this function is a part of LazyLayout harness that allows for building custom lazy layouts. LazyLayout and all corresponding APIs are still under development and are subject to change.

getDefaultLazyLayoutKey

fun getDefaultLazyLayoutKey(index: Int): Any

This creates an object meeting following requirements:

  1. Objects created for the same index are equals and never equals for different indexes.

  2. This class is saveable via a default SaveableStateRegistry on the platform.

  3. This objects can't be equals to any object which could be provided by a user as a custom key.

Note: this function is a part of LazyLayout harness that allows for building custom lazy layouts. LazyLayout and all corresponding APIs are still under development and are subject to change.