compose LazyColumn 裁剪底部的内容

Rai*_*ker 2 android android-jetpack-compose lazycolumn

我有可组合的空片段:

setContent {
    Surface(
        modifier = Modifier
            .fillMaxWidth().fillMaxHeight().padding(bottom = 48.dp, top = 16.dp),
        color = colorResource(id = R.color.usaa_white)
    ) {
        val itemsList = (0..50).toList()
        val itemsIndexedList = listOf("A", "B", "C")
        LazyColumn(
        ) {
            items(itemsList.size) {
                Text("Item is $it")
            }
            item {
                Text("Single item")
            }
            itemsIndexed(itemsIndexedList) { index, item ->
                Text("Item at index $index is $item")
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

问题是:我只能滚动内容直到“单个项目”行,其余内容被隐藏。我添加了一些填充,以确保它不是底部导航栏覆盖列表,但它仍然被裁剪。

Rai*_*ker 7

看起来这个问题是由底部导航栏引起的。有趣的是,它仅LazyColumn在我使用时发生并且工作正常。Column 我发现的修复是将 contentPadding 添加到底部。(但希望能找到更好的解决方案)

LazyColumn(contentPadding = PaddingValues(bottom = 70.dp)) { }
Run Code Online (Sandbox Code Playgroud)