将项目排列在 ScalingLazyColumn 的顶部

问题描述 投票:0回答:1

我的布局包含一个充满整个屏幕的

ScrollingLazyColumn
。 第一项应该位于屏幕顶部,但它位于中心位置。

这是我的代码:

@Preview(device = Devices.WEAR_OS_SMALL_ROUND, showBackground = true, backgroundColor = 0xff000000)
@Composable
private fun PreviewTest() {
    Scaffold() {
        ScalingLazyColumn(
            modifier = Modifier.fillMaxSize(),
            verticalArrangement = Arrangement.Top
        ) {
            item {
                Text("this should be at the top")
            }
        }
    }
}

如你所见,我已经使用了

verticalArrangement
,但它完全没有任何作用(
Bottom
也不起作用)。

如果我将

ScalingLazyColumn
换成常规
LazyColumn
,相同的代码将完美运行。

代码有bug吗?

编辑: 我刚刚意识到

ScalingLazyColumn
标有
@OptIn(ExperimentalWearFoundationApi::class)
...

我可以在某个地方提交错误报告吗?

android-jetpack-compose wear-os android-jetpack-compose-lazy-column
1个回答
0
投票

我只需要使用它来防止自动向下移动元素:

autoCentering = AutoCenteringParams(
  itemIndex = 2
)
© www.soinside.com 2019 - 2024. All rights reserved.