![](/img/trans.png)
[英]Android sticky-footer: Align footer view to table, until it reaches screen size, then become fixed.at the bottom
[英]Android sticky - footer using jetpack compose: Align footer view to table, until it reaches screen size and then become fixed at the bottom
我找到了解决方案。 我不得不在 A 使用Modifier.weight(1f, false)
。
有很多方法可以做到这一点,但最有效的方法是使用Scaffold
View 的bottomBar
属性。
例如:
@Composable
fun RenderContent() {
Scaffold(
topBar = { /* Your app bar goes here */ },
bottomBar = { /* Anything you place in here will be stick to the bottom. */ }
) {
// ... Rest of the content
// Benefits: If you make the content scrollable and
// the `bottomBar` composable remain on top of the content
}
}
如果我理解正确,您正在尝试向 LazyColmn 添加页脚视图。 JetpackCompose 中的 LazyColumn 的行为类似于原生 ListView。 我将举一个 LazyColumn 的示例,该示例在底部有一个视图(可组合),当您在列表末尾滚动时会显示该视图:
LazyColumn() {
item {
//If you want the first item to stay always on top as you scroll use stickyHeader for this section.
Text("This is the first item")
}
items(listItems.size) {
Text("This is a normal list item")
}
item {
Text("This item will behave as a footer and display at the end of the list")
}
}
希望这可以帮助某人。 谢谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.