LazyHorizontalGrid
Source set: Common
@Composable
public fun LazyHorizontalGrid(
rows: GridCells,
modifier: Modifier = Modifier,
state: LazyGridState = rememberLazyGridState(),
contentPadding: PaddingValues = PaddingValues(0.dp),
reverseLayout: Boolean = false,
horizontalArrangement: Arrangement.Horizontal =
if (!reverseLayout) Arrangement.Start else Arrangement.End,
verticalArrangement: Arrangement.Vertical = Arrangement.Top,
flingBehavior: FlingBehavior = ScrollableDefaults.flingBehavior(),
userScrollEnabled: Boolean = true,
overscrollEffect: OverscrollEffect? = rememberOverscrollEffect(),
cacheWindow: LazyLayoutCacheWindow = LazyGridDefaults.cacheWindow(state),
content: LazyGridScope.() -> Unit,
)
A lazy horizontal grid layout. It composes only visible columns of the grid.
Sample:
Sample with custom item spans:
Sample with custom cache window:
Parameters
| rows | a class describing how cells form rows, see GridCells 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 are laid out in the reverse order and LazyGridState.firstVisibleItemIndex == 0 means that grid is scrolled to the end. Note that reverseLayout does not change the behavior of horizontalArrangement, e.g. with Arrangement.Start [123###] becomes [321###]. |
| verticalArrangement | The vertical arrangement of the layout's children |
| horizontalArrangement | The horizontal arrangement of the layout's children |
| flingBehavior | logic describing fling behavior |
| 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. |
| overscrollEffect | the OverscrollEffect that will be used to render overscroll for this layout. Note that the OverscrollEffect.node will be applied internally as well - you do not need to use Modifier.overscroll separately. |
| cacheWindow | LazyLayoutCacheWindow configuring the area ahead and behind the viewport to prefetch and retain items. The default cache window does not cache items while the user is not scrolling. Override this to tune scrolling performance, such as increasing the ahead window to reduce frame drops during scrolling or adding a behind window to retain recently visible items when scrolling back and forth. |
| content | the LazyGridScope which describes the content |
LazyHorizontalGrid
Source set: Common
@Composable
@Deprecated("Use the non-deprecated overload", level = DeprecationLevel.HIDDEN)
public fun LazyHorizontalGrid(
rows: GridCells,
modifier: Modifier = Modifier,
state: LazyGridState = rememberLazyGridState(),
contentPadding: PaddingValues = PaddingValues(0.dp),
reverseLayout: Boolean = false,
horizontalArrangement: Arrangement.Horizontal =
if (!reverseLayout) Arrangement.Start else Arrangement.End,
verticalArrangement: Arrangement.Vertical = Arrangement.Top,
flingBehavior: FlingBehavior = ScrollableDefaults.flingBehavior(),
userScrollEnabled: Boolean = true,
overscrollEffect: OverscrollEffect? = rememberOverscrollEffect(),
content: LazyGridScope.() -> Unit,
)
A lazy horizontal grid layout. It composes only visible columns of the grid.
Sample:
Sample with custom item spans:
Parameters
| rows | a class describing how cells form rows, see GridCells 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 are laid out in the reverse order and LazyGridState.firstVisibleItemIndex == 0 means that grid is scrolled to the end. Note that reverseLayout does not change the behavior of horizontalArrangement, e.g. with Arrangement.Start [123###] becomes [321###]. |
| verticalArrangement | The vertical arrangement of the layout's children |
| horizontalArrangement | The horizontal arrangement of the layout's children |
| flingBehavior | logic describing fling behavior |
| 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. |
| overscrollEffect | the OverscrollEffect that will be used to render overscroll for this layout. Note that the OverscrollEffect.node will be applied internally as well - you do not need to use Modifier.overscroll separately. |
| content | the LazyGridScope which describes the content |
LazyHorizontalGrid
Source set: Common
@Deprecated("Use the non deprecated overload", level = DeprecationLevel.HIDDEN)
@Composable
public fun LazyHorizontalGrid(
rows: GridCells,
modifier: Modifier = Modifier,
state: LazyGridState = rememberLazyGridState(),
contentPadding: PaddingValues = PaddingValues(0.dp),
reverseLayout: Boolean = false,
horizontalArrangement: Arrangement.Horizontal =
if (!reverseLayout) Arrangement.Start else Arrangement.End,
verticalArrangement: Arrangement.Vertical = Arrangement.Top,
flingBehavior: FlingBehavior = ScrollableDefaults.flingBehavior(),
userScrollEnabled: Boolean = true,
content: LazyGridScope.() -> Unit,
)