TvLazyHorizontalGrid
Android
Component in Tv Foundation
A lazy horizontal grid layout. It composes only visible columns of the grid.
Last updated:
Installation
dependencies {
implementation("androidx.tv:tv-foundation:1.0.0-alpha11")
}
Overloads
@Deprecated(
"LazyHorizontalGrid will, by default, set the position of focused item while " +
"scrolling on a Tv. BringIntoViewSpec should be used to control the position.",
replaceWith =
ReplaceWith(
"LazyHorizontalGrid(" +
"modifier = modifier, " +
"contentPadding = contentPadding, " +
"reverseLayout = reverseLayout, " +
"horizontalArrangement = horizontalArrangement, " +
"verticalArrangement = verticalArrangement, " +
"userScrollEnabled = userScrollEnabled" +
") { content() }",
imports = ["androidx.compose.foundation.lazy.grid.LazyHorizontalGrid"],
)
)
@Composable
fun TvLazyHorizontalGrid(
rows: TvGridCells,
modifier: Modifier = Modifier,
state: TvLazyGridState = rememberTvLazyGridState(),
contentPadding: PaddingValues = PaddingValues(0.dp),
reverseLayout: Boolean = false,
horizontalArrangement: Arrangement.Horizontal =
if (!reverseLayout) Arrangement.Start else Arrangement.End,
verticalArrangement: Arrangement.Vertical = Arrangement.Top,
userScrollEnabled: Boolean = true,
pivotOffsets: PivotOffsets = PivotOffsets(),
content: TvLazyGridScope.() -> Unit
)
Parameters
name | description |
---|---|
rows | a class describing how cells form rows, see [TvGridCells] doc for more information |
modifier | the modifier to apply to this layout |
state | the state object to be used to control or observe the list's state |
contentPadding | specify a padding around the whole content |
reverseLayout | reverse the direction of scrolling and layout, when true items will be composed from the end to the start and [TvLazyGridState.firstVisibleItemIndex] == 0 will mean the first item is located at the end. |
verticalArrangement | The vertical arrangement of the layout's children |
horizontalArrangement | The horizontal arrangement of the layout's children |
pivotOffsets | offsets of child element within the parent and starting edge of the child from the pivot defined by the parentOffset. |
userScrollEnabled | whether the scrolling via the user gestures or accessibility actions is allowed. You can still scroll programmatically using the state even when it is disabled. |
content | the [TvLazyGridScope] which describes the content |