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

LazyVerticalGrid

Android

Component in Jetpack Glance

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

Last updated:

Installation

dependencies {
   implementation("androidx.glance:glance-appwidget:1.1.1")
}

Overloads

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

Parameters

namedescription
gridCellsthe number of columns in the grid.
modifierthe modifier to apply to this layout
horizontalAlignmentthe horizontal alignment applied to the items.
contenta 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 listof items. If the item has more than one top-level child, they will be automatically wrapped in aBox.
@ExperimentalGlanceApi
@Composable
fun LazyVerticalGrid(
    gridCells: GridCells,
    activityOptions: Bundle,
    modifier: GlanceModifier = GlanceModifier,
    horizontalAlignment: Alignment.Horizontal = Alignment.Start,
    content: LazyVerticalGridScope.() -> Unit
)

Parameters

namedescription
gridCellsthe number of columns in the grid.
activityOptionsAdditional options built from an [android.app.ActivityOptions] to apply toan activity start.
modifierthe modifier to apply to this layout
horizontalAlignmentthe horizontal alignment applied to the items.
contenta 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 listof items. If the item has more than one top-level child, they will be automatically wrapped in aBox.
by @alexstyl