androidx.glance.appwidget.lazy

Interfaces

LazyItemScope

Receiver scope being used by the item content parameter of LazyColumn.

LazyListScope

Receiver scope which is used by LazyColumn.

LazyVerticalGridScope

Receiver scope which is used by LazyColumn.

Classes

GridCells

Defines the number of columns of the GridView.

GridCells.Adaptive

Defines a grid with as many columns as possible on the condition that every cell has at least minSize space and all extra space distributed evenly.

GridCells.Fixed

Defines a fixed number of columns, limited to 1 through 5.

Annotations

Top-level functions summary

Unit
@Composable
LazyColumn(
    modifier: GlanceModifier,
    horizontalAlignment: Alignment.Horizontal,
    content: LazyListScope.() -> Unit
)

A vertical scrolling list that only lays out the currently visible items.

Unit
@ExperimentalGlanceApi
@Composable
LazyColumn(
    activityOptions: Bundle,
    modifier: GlanceModifier,
    horizontalAlignment: Alignment.Horizontal,
    content: LazyListScope.() -> Unit
)

A vertical scrolling list that only lays out the currently visible items.

Unit
@Composable
LazyVerticalGrid(
    gridCells: GridCells,
    modifier: GlanceModifier,
    horizontalAlignment: Alignment.Horizontal,
    content: LazyVerticalGridScope.() -> Unit
)

The DSL implementation of a lazy grid layout.

Unit
@ExperimentalGlanceApi
@Composable
LazyVerticalGrid(
    gridCells: GridCells,
    activityOptions: Bundle,
    modifier: GlanceModifier,
    horizontalAlignment: Alignment.Horizontal,
    content: LazyVerticalGridScope.() -> Unit
)

The DSL implementation of a lazy grid layout.

Extension functions summary

inline Unit
<T : Any?> LazyListScope.items(
    items: Array<T>,
    noinline itemId: (item) -> Long,
    crossinline itemContent: @Composable LazyItemScope.(item) -> Unit
)

Adds an array of items.

inline Unit
<T : Any?> LazyVerticalGridScope.items(
    items: Array<T>,
    noinline itemId: (item) -> Long,
    crossinline itemContent: @Composable LazyItemScope.(item) -> Unit
)

Adds an array of items.

inline Unit
<T : Any?> LazyListScope.items(
    items: List<T>,
    crossinline itemId: (item) -> Long,
    crossinline itemContent: @Composable LazyItemScope.(item) -> Unit
)

Adds a list of items.

inline Unit
<T : Any?> LazyVerticalGridScope.items(
    items: List<T>,
    crossinline itemId: (item) -> Long,
    crossinline itemContent: @Composable LazyItemScope.(item) -> Unit
)

Adds a list of items.

inline Unit
<T : Any?> LazyListScope.itemsIndexed(
    items: Array<T>,
    noinline itemId: (index: Int, item) -> Long,
    crossinline itemContent: @Composable LazyItemScope.(index: Int, item) -> Unit
)

Adds a array of items where the content of an item is aware of its index.

inline Unit
<T : Any?> LazyVerticalGridScope.itemsIndexed(
    items: Array<T>,
    noinline itemId: (index: Int, item) -> Long,
    crossinline itemContent: @Composable LazyItemScope.(index: Int, item) -> Unit
)

Adds a array of items where the content of an item is aware of its index.

inline Unit
<T : Any?> LazyListScope.itemsIndexed(
    items: List<T>,
    crossinline itemId: (index: Int, item) -> Long,
    crossinline itemContent: @Composable LazyItemScope.(index: Int, item) -> Unit
)

Adds a list of items where the content of an item is aware of its index.

inline Unit
<T : Any?> LazyVerticalGridScope.itemsIndexed(
    items: List<T>,
    crossinline itemId: (index: Int, item) -> Long,
    crossinline itemContent: @Composable LazyItemScope.(index: Int, item) -> Unit
)

Adds a list of items where the content of an item is aware of its index.

Top-level functions

@Composable
fun LazyColumn(
    modifier: GlanceModifier = GlanceModifier,
    horizontalAlignment: Alignment.Horizontal = Alignment.Start,
    content: LazyListScope.() -> Unit
): Unit

A vertical scrolling list that only lays out the currently visible items. The content block defines a DSL which allows you to emit different list items.

Parameters
modifier: GlanceModifier = GlanceModifier

the modifier to apply to this layout

horizontalAlignment: Alignment.Horizontal = Alignment.Start

the horizontal alignment applied to the items.

content: LazyListScope.() -> Unit

a block which describes the content. Inside this block you can use methods like LazyListScope.item to add a single item or LazyListScope.items to add a list of items. If the item has more than one top-level child, they will be automatically wrapped in a Box.

@ExperimentalGlanceApi
@Composable
fun LazyColumn(
    activityOptions: Bundle,
    modifier: GlanceModifier = GlanceModifier,
    horizontalAlignment: Alignment.Horizontal = Alignment.Start,
    content: LazyListScope.() -> Unit
): Unit

A vertical scrolling list that only lays out the currently visible items. The content block defines a DSL which allows you to emit different list items.

Parameters
activityOptions: Bundle

Additional options built from an android.app.ActivityOptions to apply to an activity start.

modifier: GlanceModifier = GlanceModifier

the modifier to apply to this layout

horizontalAlignment: Alignment.Horizontal = Alignment.Start

the horizontal alignment applied to the items.

content: LazyListScope.() -> Unit

a block which describes the content. Inside this block you can use methods like LazyListScope.item to add a single item or LazyListScope.items to add a list of items. If the item has more than one top-level child, they will be automatically wrapped in a Box.

LazyVerticalGrid

@Composable
fun LazyVerticalGrid(
    gridCells: GridCells,
    modifier: GlanceModifier = GlanceModifier,
    horizontalAlignment: Alignment.Horizontal = Alignment.Start,
    content: LazyVerticalGridScope.() -> Unit
): Unit

The DSL implementation of a lazy grid layout. It composes only visible rows of the grid.

Parameters
gridCells: GridCells

the number of columns in the grid.

modifier: GlanceModifier = GlanceModifier

the modifier to apply to this layout

horizontalAlignment: Alignment.Horizontal = Alignment.Start

the horizontal alignment applied to the items.

content: LazyVerticalGridScope.() -> Unit

a block which describes the content. Inside this block you can use methods like LazyVerticalGridScope.item to add a single item or LazyVerticalGridScope.items to add a list of items. If the item has more than one top-level child, they will be automatically wrapped in a Box.

LazyVerticalGrid

@ExperimentalGlanceApi
@Composable
fun LazyVerticalGrid(
    gridCells: GridCells,
    activityOptions: Bundle,
    modifier: GlanceModifier = GlanceModifier,
    horizontalAlignment: Alignment.Horizontal = Alignment.Start,
    content: LazyVerticalGridScope.() -> Unit
): Unit

The DSL implementation of a lazy grid layout. It composes only visible rows of the grid.

Parameters
gridCells: GridCells

the number of columns in the grid.

activityOptions: Bundle

Additional options built from an android.app.ActivityOptions to apply to an activity start.

modifier: GlanceModifier = GlanceModifier

the modifier to apply to this layout

horizontalAlignment: Alignment.Horizontal = Alignment.Start

the horizontal alignment applied to the items.

content: LazyVerticalGridScope.() -> Unit

a block which describes the content. Inside this block you can use methods like LazyVerticalGridScope.item to add a single item or LazyVerticalGridScope.items to add a list of items. If the item has more than one top-level child, they will be automatically wrapped in a Box.

Extension functions

inline fun <T : Any?> LazyListScope.items(
    items: Array<T>,
    noinline itemId: (item) -> Long = { LazyListScope.UnspecifiedItemId },
    crossinline itemContent: @Composable LazyItemScope.(item) -> Unit
): Unit

Adds an array of items.

Parameters
items: Array<T>

the data array

noinline itemId: (item) -> Long = { LazyListScope.UnspecifiedItemId }

a factory of stable and unique list item ids. Using the same itemId for multiple items in the array is not allowed. When you specify the itemId, the scroll position will be maintained based on the itemId, which means if you add/remove items before the current visible item the item with the given itemId will be kept as the first visible one.

crossinline itemContent: @Composable LazyItemScope.(item) -> Unit

the content displayed by a single item

inline fun <T : Any?> LazyVerticalGridScope.items(
    items: Array<T>,
    noinline itemId: (item) -> Long = { LazyVerticalGridScope.UnspecifiedItemId },
    crossinline itemContent: @Composable LazyItemScope.(item) -> Unit
): Unit

Adds an array of items.

Parameters
items: Array<T>

the data array

noinline itemId: (item) -> Long = { LazyVerticalGridScope.UnspecifiedItemId }

a factory of stable and unique list item ids. Using the same itemId for multiple items in the array is not allowed. When you specify the itemId, the scroll position will be maintained based on the itemId, which means if you add/remove items before the current visible item the item with the given itemId will be kept as the first visible one.

crossinline itemContent: @Composable LazyItemScope.(item) -> Unit

the content displayed by a single item

inline fun <T : Any?> LazyListScope.items(
    items: List<T>,
    crossinline itemId: (item) -> Long = { LazyListScope.UnspecifiedItemId },
    crossinline itemContent: @Composable LazyItemScope.(item) -> Unit
): Unit

Adds a list of items.

Parameters
items: List<T>

the data list

crossinline itemId: (item) -> Long = { LazyListScope.UnspecifiedItemId }

a factory of stable and unique ids representing the item. The value may not be less than or equal to -2^62, as these values are reserved by the Glance API. Specifying the list item ids will maintain the scroll position through app widget updates in Android S and higher devices.

crossinline itemContent: @Composable LazyItemScope.(item) -> Unit

the content displayed by a single item

inline fun <T : Any?> LazyVerticalGridScope.items(
    items: List<T>,
    crossinline itemId: (item) -> Long = { LazyVerticalGridScope.UnspecifiedItemId },
    crossinline itemContent: @Composable LazyItemScope.(item) -> Unit
): Unit

Adds a list of items.

Parameters
items: List<T>

the data list

crossinline itemId: (item) -> Long = { LazyVerticalGridScope.UnspecifiedItemId }

a factory of stable and unique ids representing the item. The value may not be less than or equal to -2^62, as these values are reserved by the Glance API. Specifying the list item ids will maintain the scroll position through app widget updates in Android S and higher devices.

crossinline itemContent: @Composable LazyItemScope.(item) -> Unit

the content displayed by a single item

itemsIndexed

inline fun <T : Any?> LazyListScope.itemsIndexed(
    items: Array<T>,
    noinline itemId: (index: Int, item) -> Long = { _, _ -> LazyListScope.UnspecifiedItemId },
    crossinline itemContent: @Composable LazyItemScope.(index: Int, item) -> Unit
): Unit

Adds a array of items where the content of an item is aware of its index.

Parameters
items: Array<T>

the data array

noinline itemId: (index: Int, item) -> Long = { _, _ -> LazyListScope.UnspecifiedItemId }

a factory of stable and unique list item ids. Using the same itemId for multiple items in the array is not allowed. When you specify the itemId the scroll position will be maintained based on the itemId, which means if you add/remove items before the current visible item the item with the given itemId will be kept as the first visible one.

crossinline itemContent: @Composable LazyItemScope.(index: Int, item) -> Unit

the content displayed by a single item

itemsIndexed

inline fun <T : Any?> LazyVerticalGridScope.itemsIndexed(
    items: Array<T>,
    noinline itemId: (index: Int, item) -> Long = { _, _ -> LazyVerticalGridScope.UnspecifiedItemId },
    crossinline itemContent: @Composable LazyItemScope.(index: Int, item) -> Unit
): Unit

Adds a array of items where the content of an item is aware of its index.

Parameters
items: Array<T>

the data array

noinline itemId: (index: Int, item) -> Long = { _, _ -> LazyVerticalGridScope.UnspecifiedItemId }

a factory of stable and unique list item ids. Using the same itemId for multiple items in the array is not allowed. When you specify the itemId the scroll position will be maintained based on the itemId, which means if you add/remove items before the current visible item the item with the given itemId will be kept as the first visible one.

crossinline itemContent: @Composable LazyItemScope.(index: Int, item) -> Unit

the content displayed by a single item

inline fun <T : Any?> LazyListScope.itemsIndexed(
    items: List<T>,
    crossinline itemId: (index: Int, item) -> Long = { _, _ -> LazyListScope.UnspecifiedItemId },
    crossinline itemContent: @Composable LazyItemScope.(index: Int, item) -> Unit
): Unit

Adds a list of items where the content of an item is aware of its index.

Parameters
items: List<T>

the data list

crossinline itemId: (index: Int, item) -> Long = { _, _ -> LazyListScope.UnspecifiedItemId }

a factory of stable and unique ids representing the item. The value may not be less than or equal to -2^62, as these values are reserved by the Glance API. Specifying the list item ids will maintain the scroll position through app widget updates in Android S and higher devices.

crossinline itemContent: @Composable LazyItemScope.(index: Int, item) -> Unit

the content displayed by a single item

inline fun <T : Any?> LazyVerticalGridScope.itemsIndexed(
    items: List<T>,
    crossinline itemId: (index: Int, item) -> Long = { _, _ -> LazyVerticalGridScope.UnspecifiedItemId },
    crossinline itemContent: @Composable LazyItemScope.(index: Int, item) -> Unit
): Unit

Adds a list of items where the content of an item is aware of its index.

Parameters
items: List<T>

the data list

crossinline itemId: (index: Int, item) -> Long = { _, _ -> LazyVerticalGridScope.UnspecifiedItemId }

a factory of stable and unique ids representing the item. The value may not be less than or equal to -2^62, as these values are reserved by the Glance API. Specifying the list item ids will maintain the scroll position through app widget updates in Android S and higher devices.

crossinline itemContent: @Composable LazyItemScope.(index: Int, item) -> Unit

the content displayed by a single item