yschimke
11/10/2022, 6:38 AMIlya K
11/10/2022, 7:03 AMval scalingLazyState = remember { ScalingLazyListState(initialCenterItemIndex = 0) }
But it had no affect.
Then i’ve tried in ScalingLazyColumn define
autoCentering = AutoCenteringParams(itemIndex = 0)
Then i’ve also tried to add
anchorType = ScalingLazyListAnchorType.ItemStart
Again, no effect.Ilya K
11/10/2022, 7:27 AMstevebower
11/10/2022, 10:01 AMIlya K
11/10/2022, 12:12 PMJohn Nichol
11/10/2022, 12:38 PM@Preview(device = Devices.WEAR_OS_SMALL_ROUND, showSystemUi = true)
@Composable
fun SingleItemSLCWithLongText(modifier: Modifier = Modifier) {
val scalingLazyState = remember { ScalingLazyListState(initialCenterItemIndex = 0, initialCenterItemScrollOffset = 80) }
val focusRequester = remember { FocusRequester() }
Scaffold(
modifier = modifier.background(Color.Black),
positionIndicator = { PositionIndicator(scalingLazyListState = scalingLazyState) }
) {
ScalingLazyColumn(
modifier = Modifier.scrollableColumn(focusRequester, scalingLazyState),
autoCentering = AutoCenteringParams(itemIndex = 0, itemOffset = 80),
state = scalingLazyState,
anchorType = ScalingLazyListAnchorType.ItemStart
) {
item {
Text(
longText,
Modifier
.padding(start = 16.dp, end = 16.dp, bottom = 48.dp),
textAlign = TextAlign.Center,
)
}
}
}
}
John Nichol
11/10/2022, 12:38 PMIlya K
11/10/2022, 2:07 PM