Stay organized with collections
Save and categorize content based on your preferences.
@RequiresApi(value = 31)
class GridCells.Adaptive : GridCells
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.
For example, for the vertical LazyVerticalGrid
Adaptive(20.dp) would mean that there will be as many columns as possible and every column will be at least 20.dp and all the columns will have equal width. If the screen is 88.dp wide then there will be 4 columns 22.dp each.
Summary
Public properties |
Dp |
fixed width of each column in LazyVerticalGrid
|
Public constructors
Adaptive(minSize: Dp)
Parameters |
minSize: Dp |
fixed width of each column in LazyVerticalGrid
|
Public properties
val minSize: Dp
fixed width of each column in LazyVerticalGrid
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-05-15 UTC.
[null,null,["Last updated 2025-05-15 UTC."],[],[],null,["# GridCells.Adaptive\n==================\n\nArtifact: [androidx.glance:glance-appwidget](/jetpack/androidx/releases/glance) \n[View Source](https://cs.android.com/search?q=file:androidx/glance/appwidget/lazy/LazyVerticalGrid.kt+class:androidx.glance.appwidget.lazy.GridCells.Adaptive) \nAdded in [1.0.0](/jetpack/androidx/releases/glance#1.0.0)\n\n\n```\n@RequiresApi(value = 31)\nclass GridCells.Adaptive : GridCells\n```\n\n\u003cbr /\u003e\n\n|---|---|--------------------------------------------------------------------------------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) |||\n| ↳ | [androidx.glance.appwidget.lazy.GridCells](/reference/kotlin/androidx/glance/appwidget/lazy/GridCells) ||\n| | ↳ | [androidx.glance.appwidget.lazy.GridCells.Adaptive](/reference/kotlin/androidx/glance/appwidget/lazy/GridCells.Adaptive) |\n\n*** ** * ** ***\n\nDefines a grid with as many columns as possible on the condition that every cell has at least [minSize](/reference/kotlin/androidx/glance/appwidget/lazy/GridCells.Adaptive#minSize()) space and all extra space distributed evenly.\n\nFor example, for the vertical [LazyVerticalGrid](/reference/kotlin/androidx/glance/appwidget/lazy/package-summary#LazyVerticalGrid(androidx.glance.appwidget.lazy.GridCells,androidx.glance.GlanceModifier,androidx.glance.layout.Alignment.Horizontal,kotlin.Function1)) Adaptive(20.dp) would mean that there will be as many columns as possible and every column will be at least 20.dp and all the columns will have equal width. If the screen is 88.dp wide then there will be 4 columns 22.dp each.\n\nSummary\n-------\n\n| ### Public constructors |\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Adaptive](/reference/kotlin/androidx/glance/appwidget/lazy/GridCells.Adaptive#Adaptive(androidx.compose.ui.unit.Dp))`(minSize: `[Dp](/reference/kotlin/androidx/compose/ui/unit/Dp)`)` |\n\n| ### Public functions |\n|-----------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `open operator `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | [equals](/reference/kotlin/androidx/glance/appwidget/lazy/GridCells.Adaptive#equals(kotlin.Any))`(other: `[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`?)` |\n| `open `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [hashCode](/reference/kotlin/androidx/glance/appwidget/lazy/GridCells.Adaptive#hashCode())`()` |\n\n| ### Public properties |\n|-----------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------|\n| [Dp](/reference/kotlin/androidx/compose/ui/unit/Dp) | [minSize](/reference/kotlin/androidx/glance/appwidget/lazy/GridCells.Adaptive#minSize()) fixed width of each column in LazyVerticalGrid |\n\nPublic constructors\n-------------------\n\n### Adaptive\n\n```\nAdaptive(minSize: Dp)\n``` \n\n| Parameters |\n|----------------------------------------------------------------|------------------------------------------------|\n| `minSize: `[Dp](/reference/kotlin/androidx/compose/ui/unit/Dp) | fixed width of each column in LazyVerticalGrid |\n\nPublic functions\n----------------\n\n### equals\n\n```\nopen operator fun equals(other: Any?): Boolean\n``` \n\n### hashCode\n\n```\nopen fun hashCode(): Int\n``` \n\nPublic properties\n-----------------\n\n### minSize\n\nAdded in [1.0.0](/jetpack/androidx/releases/glance#1.0.0) \n\n```\nval minSize: Dp\n```\n\nfixed width of each column in LazyVerticalGrid"]]