| <html devsite="true"> |
| <head> |
| <title>LazyListScope</title> |
| {% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} |
| {% include "_shared/_reference-head-tags.html" %} |
| </head> |
| <body> |
| <h1>LazyListScope</h1> |
| <p> |
| <pre>@<a href="/reference/androidx/compose/foundation/lazy/LazyScopeMarker.html">LazyScopeMarker</a> interface LazyListScope</pre> |
| </p> |
| <hr> |
| <p>Receiver scope which is used by <code><a href="/reference/androidx/compose/foundation/lazy/package-summary.html#LazyColumn(Modifier,androidx.compose.foundation.lazy.LazyListState,androidx.compose.foundation.layout.PaddingValues,kotlin.Boolean,androidx.compose.foundation.layout.Arrangement.Vertical,Alignment.Horizontal,androidx.compose.foundation.gestures.FlingBehavior,kotlin.Function1)">LazyColumn</a></code> and <code><a href="/reference/androidx/compose/foundation/lazy/package-summary.html#LazyRow(Modifier,androidx.compose.foundation.lazy.LazyListState,androidx.compose.foundation.layout.PaddingValues,kotlin.Boolean,androidx.compose.foundation.layout.Arrangement.Horizontal,Alignment.Vertical,androidx.compose.foundation.gestures.FlingBehavior,kotlin.Function1)">LazyRow</a></code>.</p> |
| <h2>Summary</h2> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <thead> |
| <tr> |
| <th colspan="2"><h3>Public methods</h3></th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td width="40%"><code>abstract void</code></td> |
| <td> |
| <div><code><a href="/reference/androidx/compose/foundation/lazy/LazyListScope.html#item(kotlin.Any,kotlin.Function1)">item</a>(<br> <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a> key,<br> @<a href="/reference/androidx/compose/runtime/Composable.html">Composable</a> @<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-extension-function-type/index.html">ExtensionFunctionType</a> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function1<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/foundation/lazy/LazyItemScope.html">LazyItemScope</a>, <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a>> content<br>)</code></div> |
| <p>Adds a single item.</p> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>abstract void</code></td> |
| <td> |
| <div><code><a href="/reference/androidx/compose/foundation/lazy/LazyListScope.html#items(kotlin.Int,kotlin.Function1,kotlin.Function2)">items</a>(<br> int count,<br> Function1<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Integer.html">Integer</a>, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> key,<br> @<a href="/reference/androidx/compose/runtime/Composable.html">Composable</a> @<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-extension-function-type/index.html">ExtensionFunctionType</a> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function2<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/foundation/lazy/LazyItemScope.html">LazyItemScope</a>, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Integer.html">Integer</a>, <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a>> itemContent<br>)</code></div> |
| <p>Adds a <code><a href="/reference/androidx/compose/foundation/lazy/LazyListScope.html#items(kotlin.Int,kotlin.Function1,kotlin.Function2)">count</a></code> of items.</p> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>abstract @<a href="/reference/androidx/compose/foundation/ExperimentalFoundationApi.html">ExperimentalFoundationApi</a> void</code></td> |
| <td> |
| <div><code><a href="/reference/androidx/compose/foundation/lazy/LazyListScope.html#stickyHeader(kotlin.Any,kotlin.Function1)">stickyHeader</a>(<br> <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a> key,<br> @<a href="/reference/androidx/compose/runtime/Composable.html">Composable</a> @<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-extension-function-type/index.html">ExtensionFunctionType</a> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function1<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/foundation/lazy/LazyItemScope.html">LazyItemScope</a>, <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a>> content<br>)</code></div> |
| <p>Adds a sticky header item, which will remain pinned even when scrolling after it.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <thead> |
| <tr> |
| <th colspan="2"><h3>Extension functions</h3></th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td width="40%"><code>default final void</code></td> |
| <td> |
| <div><code><T extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> <a href="/reference/androidx/compose/foundation/lazy/LazyDslKt.html">LazyDslKt</a>.<a href="/reference/androidx/compose/foundation/lazy/package-summary.html#(androidx.compose.foundation.lazy.LazyListScope).items(kotlin.collections.List,kotlin.Function1,kotlin.Function2)">items</a>(<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/foundation/lazy/LazyListScope.html">LazyListScope</a> receiver,<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/util/List.html">List</a><@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T> items,<br> Function1<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> item, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> key,<br> @<a href="/reference/androidx/compose/runtime/Composable.html">Composable</a> @<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-extension-function-type/index.html">ExtensionFunctionType</a> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function2<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/foundation/lazy/LazyItemScope.html">LazyItemScope</a>, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> item, <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a>> itemContent<br>)</code></div> |
| <p>Adds a list of items.</p> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>default final void</code></td> |
| <td> |
| <div><code><T extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> <a href="/reference/androidx/compose/foundation/lazy/LazyDslKt.html">LazyDslKt</a>.<a href="/reference/androidx/compose/foundation/lazy/package-summary.html#(androidx.compose.foundation.lazy.LazyListScope).items(kotlin.Array,kotlin.Function1,kotlin.Function2)">items</a>(<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/foundation/lazy/LazyListScope.html">LazyListScope</a> receiver,<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T[] items,<br> Function1<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> item, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> key,<br> @<a href="/reference/androidx/compose/runtime/Composable.html">Composable</a> @<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-extension-function-type/index.html">ExtensionFunctionType</a> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function2<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/foundation/lazy/LazyItemScope.html">LazyItemScope</a>, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> item, <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a>> itemContent<br>)</code></div> |
| <p>Adds an array of items.</p> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>default final void</code></td> |
| <td> |
| <div><code><T extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> <a href="/reference/androidx/compose/foundation/lazy/LazyDslKt.html">LazyDslKt</a>.<a href="/reference/androidx/compose/foundation/lazy/package-summary.html#(androidx.compose.foundation.lazy.LazyListScope).itemsIndexed(kotlin.collections.List,kotlin.Function2,kotlin.Function3)">itemsIndexed</a>(<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/foundation/lazy/LazyListScope.html">LazyListScope</a> receiver,<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/util/List.html">List</a><@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T> items,<br> Function2<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Integer.html">Integer</a>, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> item, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> key,<br> @<a href="/reference/androidx/compose/runtime/Composable.html">Composable</a> @<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-extension-function-type/index.html">ExtensionFunctionType</a> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function3<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/foundation/lazy/LazyItemScope.html">LazyItemScope</a>, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Integer.html">Integer</a>, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> item, <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a>> itemContent<br>)</code></div> |
| <p>Adds a list of items where the content of an item is aware of its index.</p> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>default final void</code></td> |
| <td> |
| <div><code><T extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> <a href="/reference/androidx/compose/foundation/lazy/LazyDslKt.html">LazyDslKt</a>.<a href="/reference/androidx/compose/foundation/lazy/package-summary.html#(androidx.compose.foundation.lazy.LazyListScope).itemsIndexed(kotlin.Array,kotlin.Function2,kotlin.Function3)">itemsIndexed</a>(<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/foundation/lazy/LazyListScope.html">LazyListScope</a> receiver,<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T[] items,<br> Function2<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Integer.html">Integer</a>, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> item, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> key,<br> @<a href="/reference/androidx/compose/runtime/Composable.html">Composable</a> @<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-extension-function-type/index.html">ExtensionFunctionType</a> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function3<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/foundation/lazy/LazyItemScope.html">LazyItemScope</a>, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Integer.html">Integer</a>, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> item, <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a>> itemContent<br>)</code></div> |
| <p>Adds an array of items where the content of an item is aware of its index.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <h2>Public methods</h2> |
| <div><a name="item(kotlin.Any, kotlin.Function1)"></a><a name="item-kotlin.Any-kotlin.Function1-"></a><a name="item"></a> |
| <h3 class="api-name" id="item(kotlin.Any,kotlin.Function1)">item</h3> |
| <pre class="api-signature no-pretty-print">abstract void <a href="/reference/androidx/compose/foundation/lazy/LazyListScope.html#item(kotlin.Any,kotlin.Function1)">item</a>(<br> <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a> key,<br> @<a href="/reference/androidx/compose/runtime/Composable.html">Composable</a> @<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-extension-function-type/index.html">ExtensionFunctionType</a> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function1<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/foundation/lazy/LazyItemScope.html">LazyItemScope</a>, <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a>> content<br>)</pre> |
| <p>Adds a single item.</p> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <thead> |
| <tr> |
| <th colspan="2">Parameters</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td width="40%"><code><a href="https://developer.android.com/reference/java/lang/Object.html">Object</a> key</code></td> |
| <td> |
| <p>a stable and unique key 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.</p> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>@<a href="/reference/androidx/compose/runtime/Composable.html">Composable</a> @<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-extension-function-type/index.html">ExtensionFunctionType</a> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function1<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/foundation/lazy/LazyItemScope.html">LazyItemScope</a>, <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a>> content</code></td> |
| <td> |
| <p>the content of the item</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| <div><a name="items(kotlin.Int, kotlin.Function1, kotlin.Function2)"></a><a name="items-kotlin.Int-kotlin.Function1-kotlin.Function2-"></a><a name="items"></a> |
| <h3 class="api-name" id="items(kotlin.Int,kotlin.Function1,kotlin.Function2)">items</h3> |
| <pre class="api-signature no-pretty-print">abstract void <a href="/reference/androidx/compose/foundation/lazy/LazyListScope.html#items(kotlin.Int,kotlin.Function1,kotlin.Function2)">items</a>(<br> int count,<br> Function1<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Integer.html">Integer</a>, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> key,<br> @<a href="/reference/androidx/compose/runtime/Composable.html">Composable</a> @<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-extension-function-type/index.html">ExtensionFunctionType</a> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function2<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/foundation/lazy/LazyItemScope.html">LazyItemScope</a>, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Integer.html">Integer</a>, <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a>> itemContent<br>)</pre> |
| <p>Adds a <code><a href="/reference/androidx/compose/foundation/lazy/LazyListScope.html#items(kotlin.Int,kotlin.Function1,kotlin.Function2)">count</a></code> of items.</p> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <thead> |
| <tr> |
| <th colspan="2">Parameters</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td width="40%"><code>int count</code></td> |
| <td> |
| <p>the items count</p> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>Function1<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Integer.html">Integer</a>, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> key</code></td> |
| <td> |
| <p>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.</p> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>@<a href="/reference/androidx/compose/runtime/Composable.html">Composable</a> @<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-extension-function-type/index.html">ExtensionFunctionType</a> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function2<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/foundation/lazy/LazyItemScope.html">LazyItemScope</a>, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Integer.html">Integer</a>, <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a>> itemContent</code></td> |
| <td> |
| <p>the content displayed by a single item</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| <div><a name="stickyHeader(kotlin.Any, kotlin.Function1)"></a><a name="stickyHeader-kotlin.Any-kotlin.Function1-"></a><a name="stickyheader"></a> |
| <h3 class="api-name" id="stickyHeader(kotlin.Any,kotlin.Function1)">stickyHeader</h3> |
| <pre class="api-signature no-pretty-print">@<a href="/reference/androidx/compose/foundation/ExperimentalFoundationApi.html">ExperimentalFoundationApi</a><br>abstract void <a href="/reference/androidx/compose/foundation/lazy/LazyListScope.html#stickyHeader(kotlin.Any,kotlin.Function1)">stickyHeader</a>(<br> <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a> key,<br> @<a href="/reference/androidx/compose/runtime/Composable.html">Composable</a> @<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-extension-function-type/index.html">ExtensionFunctionType</a> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function1<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/foundation/lazy/LazyItemScope.html">LazyItemScope</a>, <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a>> content<br>)</pre> |
| <p>Adds a sticky header item, which will remain pinned even when scrolling after it. The header will remain pinned until the next header will take its place.</p> |
| <pre class="prettyprint"> |
| import androidx.compose.foundation.background |
| import androidx.compose.foundation.layout.PaddingValues |
| import androidx.compose.foundation.layout.fillMaxWidth |
| import androidx.compose.foundation.layout.padding |
| import androidx.compose.foundation.lazy.LazyColumn |
| import androidx.compose.foundation.lazy.items |
| import androidx.compose.material.Text |
| |
| val sections = listOf("A", "B", "C", "D", "E", "F", "G") |
| |
| LazyColumn(reverseLayout = true, contentPadding = PaddingValues(6.dp)) { |
| sections.forEach { section -> |
| stickyHeader { |
| Text( |
| "Section $section", |
| Modifier.fillMaxWidth().background(Color.LightGray).padding(8.dp) |
| ) |
| } |
| items(10) { |
| Text("Item $it from the section $section") |
| } |
| } |
| }</pre> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <thead> |
| <tr> |
| <th colspan="2">Parameters</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td width="40%"><code><a href="https://developer.android.com/reference/java/lang/Object.html">Object</a> key</code></td> |
| <td> |
| <p>a stable and unique key 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.</p> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>@<a href="/reference/androidx/compose/runtime/Composable.html">Composable</a> @<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-extension-function-type/index.html">ExtensionFunctionType</a> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function1<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/foundation/lazy/LazyItemScope.html">LazyItemScope</a>, <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a>> content</code></td> |
| <td> |
| <p>the content of the header</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| <h2>Extension functions</h2> |
| <div><a name="(androidx.compose.foundation.lazy.LazyListScope).items(kotlin.collections.List, kotlin.Function1, kotlin.Function2)"></a><a name="-androidx.compose.foundation.lazy.LazyListScope-.items-kotlin.collections.List-kotlin.Function1-kotlin.Function2-"></a><a name="items"></a> |
| <h3 class="api-name" id="(androidx.compose.foundation.lazy.LazyListScope).items(kotlin.collections.List,kotlin.Function1,kotlin.Function2)">LazyDslKt.items</h3> |
| <pre class="api-signature no-pretty-print">default final void <T extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> <a href="/reference/androidx/compose/foundation/lazy/LazyDslKt.html">LazyDslKt</a>.<a href="/reference/androidx/compose/foundation/lazy/package-summary.html#(androidx.compose.foundation.lazy.LazyListScope).items(kotlin.collections.List,kotlin.Function1,kotlin.Function2)">items</a>(<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/foundation/lazy/LazyListScope.html">LazyListScope</a> receiver,<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/util/List.html">List</a><@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T> items,<br> Function1<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> item, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> key,<br> @<a href="/reference/androidx/compose/runtime/Composable.html">Composable</a> @<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-extension-function-type/index.html">ExtensionFunctionType</a> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function2<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/foundation/lazy/LazyItemScope.html">LazyItemScope</a>, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> item, <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a>> itemContent<br>)</pre> |
| <p>Adds a list of items.</p> |
| <p>the data list</p> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <thead> |
| <tr> |
| <th colspan="2">Parameters</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td width="40%"><code>Function1<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> item, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> key</code></td> |
| <td> |
| <p>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.</p> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>@<a href="/reference/androidx/compose/runtime/Composable.html">Composable</a> @<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-extension-function-type/index.html">ExtensionFunctionType</a> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function2<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/foundation/lazy/LazyItemScope.html">LazyItemScope</a>, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> item, <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a>> itemContent</code></td> |
| <td> |
| <p>the content displayed by a single item</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| <div><a name="(androidx.compose.foundation.lazy.LazyListScope).items(kotlin.Array, kotlin.Function1, kotlin.Function2)"></a><a name="-androidx.compose.foundation.lazy.LazyListScope-.items-kotlin.Array-kotlin.Function1-kotlin.Function2-"></a><a name="items"></a> |
| <h3 class="api-name" id="(androidx.compose.foundation.lazy.LazyListScope).items(kotlin.Array,kotlin.Function1,kotlin.Function2)">LazyDslKt.items</h3> |
| <pre class="api-signature no-pretty-print">default final void <T extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> <a href="/reference/androidx/compose/foundation/lazy/LazyDslKt.html">LazyDslKt</a>.<a href="/reference/androidx/compose/foundation/lazy/package-summary.html#(androidx.compose.foundation.lazy.LazyListScope).items(kotlin.Array,kotlin.Function1,kotlin.Function2)">items</a>(<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/foundation/lazy/LazyListScope.html">LazyListScope</a> receiver,<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T[] items,<br> Function1<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> item, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> key,<br> @<a href="/reference/androidx/compose/runtime/Composable.html">Composable</a> @<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-extension-function-type/index.html">ExtensionFunctionType</a> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function2<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/foundation/lazy/LazyItemScope.html">LazyItemScope</a>, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> item, <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a>> itemContent<br>)</pre> |
| <p>Adds an array of items.</p> |
| <p>the data array</p> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <thead> |
| <tr> |
| <th colspan="2">Parameters</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td width="40%"><code>Function1<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> item, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> key</code></td> |
| <td> |
| <p>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.</p> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>@<a href="/reference/androidx/compose/runtime/Composable.html">Composable</a> @<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-extension-function-type/index.html">ExtensionFunctionType</a> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function2<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/foundation/lazy/LazyItemScope.html">LazyItemScope</a>, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> item, <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a>> itemContent</code></td> |
| <td> |
| <p>the content displayed by a single item</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| <div><a name="(androidx.compose.foundation.lazy.LazyListScope).itemsIndexed(kotlin.collections.List, kotlin.Function2, kotlin.Function3)"></a><a name="-androidx.compose.foundation.lazy.LazyListScope-.itemsIndexed-kotlin.collections.List-kotlin.Function2-kotlin.Function3-"></a><a name="itemsindexed"></a> |
| <h3 class="api-name" id="(androidx.compose.foundation.lazy.LazyListScope).itemsIndexed(kotlin.collections.List,kotlin.Function2,kotlin.Function3)">LazyDslKt.itemsIndexed</h3> |
| <pre class="api-signature no-pretty-print">default final void <T extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> <a href="/reference/androidx/compose/foundation/lazy/LazyDslKt.html">LazyDslKt</a>.<a href="/reference/androidx/compose/foundation/lazy/package-summary.html#(androidx.compose.foundation.lazy.LazyListScope).itemsIndexed(kotlin.collections.List,kotlin.Function2,kotlin.Function3)">itemsIndexed</a>(<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/foundation/lazy/LazyListScope.html">LazyListScope</a> receiver,<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/util/List.html">List</a><@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T> items,<br> Function2<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Integer.html">Integer</a>, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> item, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> key,<br> @<a href="/reference/androidx/compose/runtime/Composable.html">Composable</a> @<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-extension-function-type/index.html">ExtensionFunctionType</a> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function3<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/foundation/lazy/LazyItemScope.html">LazyItemScope</a>, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Integer.html">Integer</a>, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> item, <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a>> itemContent<br>)</pre> |
| <p>Adds a list of items where the content of an item is aware of its index.</p> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <thead> |
| <tr> |
| <th colspan="2">Parameters</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/util/List.html">List</a><@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T> items</code></td> |
| <td> |
| <p>the data list</p> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>Function2<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Integer.html">Integer</a>, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> item, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> key</code></td> |
| <td> |
| <p>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.</p> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>@<a href="/reference/androidx/compose/runtime/Composable.html">Composable</a> @<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-extension-function-type/index.html">ExtensionFunctionType</a> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function3<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/foundation/lazy/LazyItemScope.html">LazyItemScope</a>, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Integer.html">Integer</a>, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> item, <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a>> itemContent</code></td> |
| <td> |
| <p>the content displayed by a single item</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| <div><a name="(androidx.compose.foundation.lazy.LazyListScope).itemsIndexed(kotlin.Array, kotlin.Function2, kotlin.Function3)"></a><a name="-androidx.compose.foundation.lazy.LazyListScope-.itemsIndexed-kotlin.Array-kotlin.Function2-kotlin.Function3-"></a><a name="itemsindexed"></a> |
| <h3 class="api-name" id="(androidx.compose.foundation.lazy.LazyListScope).itemsIndexed(kotlin.Array,kotlin.Function2,kotlin.Function3)">LazyDslKt.itemsIndexed</h3> |
| <pre class="api-signature no-pretty-print">default final void <T extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> <a href="/reference/androidx/compose/foundation/lazy/LazyDslKt.html">LazyDslKt</a>.<a href="/reference/androidx/compose/foundation/lazy/package-summary.html#(androidx.compose.foundation.lazy.LazyListScope).itemsIndexed(kotlin.Array,kotlin.Function2,kotlin.Function3)">itemsIndexed</a>(<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/foundation/lazy/LazyListScope.html">LazyListScope</a> receiver,<br> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T[] items,<br> Function2<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Integer.html">Integer</a>, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> item, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> key,<br> @<a href="/reference/androidx/compose/runtime/Composable.html">Composable</a> @<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-extension-function-type/index.html">ExtensionFunctionType</a> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function3<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/foundation/lazy/LazyItemScope.html">LazyItemScope</a>, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Integer.html">Integer</a>, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> item, <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a>> itemContent<br>)</pre> |
| <p>Adds an array of items where the content of an item is aware of its index.</p> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <thead> |
| <tr> |
| <th colspan="2">Parameters</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T[] items</code></td> |
| <td> |
| <p>the data array</p> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>Function2<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Integer.html">Integer</a>, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> item, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> key</code></td> |
| <td> |
| <p>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.</p> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>@<a href="/reference/androidx/compose/runtime/Composable.html">Composable</a> @<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-extension-function-type/index.html">ExtensionFunctionType</a> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function3<@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/foundation/lazy/LazyItemScope.html">LazyItemScope</a>, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/Integer.html">Integer</a>, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> item, <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a>> itemContent</code></td> |
| <td> |
| <p>the content displayed by a single item</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| </body> |
| </html> |