Colton Idle
08/04/2021, 9:09 PMColton Idle
08/04/2021, 9:12 PMColumn(modifier = Modifier.fillMaxSize().padding(horizontal = 16.dp)) {
Box(modifier = Modifier.weight(1f), contentAlignment = Alignment.BottomCenter) {
Button(onClick = {}) {}
}
}
Colton Idle
08/04/2021, 9:13 PMColumn(modifier = Modifier.fillMaxSize().padding(horizontal = 16.dp)) {
Crossfade(
modifier = Modifier.weight(1f),
targetState = viewModel.state.loading) { asdf ->
Box(modifier = Modifier.weight(1f), contentAlignment = Alignment.BottomCenter) {
Button(onClick = {}) {}
}
}
}
Abhishek Dewan
08/04/2021, 9:30 PMAbhishek Dewan
08/04/2021, 9:30 PMColton Idle
08/04/2021, 9:42 PMColton Idle
08/04/2021, 9:47 PMColumn(
modifier = Modifier.fillMaxSize().padding(horizontal = 16.dp),
verticalArrangement = Arrangement.Bottom) {
and the button still goes to the top.Chris Sinco [G]
08/04/2021, 9:52 PMalign
modifier to the Crossfade as well. Would also help to see a design spec of what you are trying to achieveColton Idle
08/04/2021, 10:03 PMDoris Liu
08/05/2021, 12:45 AMweight
Modifier is only meaningful when the parent layout understands it. More specifically, it is only defined in RowScope
and ColumnScope
.
That's why the weight(1f)
on Box
in Crossfade
is a no-op. Box
ends up wraps its content as a result. Since the Box
is the same size as the Button, contentAlignment
doesn't make any difference. You could change the weight(1f) on Box to fillMaxHeight()
Colton Idle
08/05/2021, 4:38 AMAbhishek Dewan
08/05/2021, 5:40 AM