items
Function
Android
public inline fun <T> ScalingLazyListScope.items(
items: List<T>,
noinline key: ((item: T) -> Any)? = null,
crossinline itemContent: @Composable ScalingLazyListItemScope.(item: T) -> Unit,
): Unit
Adds a list of items.
Parameters
items | the data list |
key | a factory of stable and unique keys representing the item. Using the same key for multiple items in the list is not allowed. Type of the key should be saveable via Bundle on Android. If null is passed the position in the list will represent the key. When you specify the key the scroll position will be maintained based on the key, which means if you add/remove items before the current visible item the item with the given key will be kept as the first visible one. |
itemContent | the content displayed by a single item |
Android
public inline fun <T> ScalingLazyListScope.items(
items: Array<T>,
noinline key: ((item: T) -> Any)? = null,
crossinline itemContent: @Composable ScalingLazyListItemScope.(item: T) -> Unit,
): Unit
Adds an array of items.
Parameters
items | the data array |
key | a factory of stable and unique keys representing the item. Using the same key for multiple items in the list is not allowed. Type of the key should be saveable via Bundle on Android. If null is passed the position in the list will represent the key. When you specify the key the scroll position will be maintained based on the key, which means if you add/remove items before the current visible item the item with the given key will be kept as the first visible one. |
itemContent | the content displayed by a single item |
Android
public inline fun <T> TransformingLazyColumnScope.items(
items: List<T>,
noinline key: ((item: T) -> Any)? = null,
noinline contentType: (item: T) -> Any? = { null },
crossinline itemContent: @Composable TransformingLazyColumnItemScope.(item: T) -> Unit,
): Unit
Adds a list of items.
Parameters
items | the data list |
key | a factory of stable and unique keys representing the item. Using the same key for multiple items in the TransformingLazyColumn is not allowed. Type of the key should be saveable via Bundle on Android. If null is passed the position in the TransformingLazyColumn will represent the key. When you specify the key the scroll position will be maintained based on the key, which means if you add/remove items before the current visible item the item with the given key will be kept as the first visible one. |
contentType | a factory of the content types for the item. The item compositions of the same type could be reused more efficiently. Note that null is a valid type and items of such type will be considered compatible. |
itemContent | the content displayed by a single item. |