I want to have a `Column` with a `Button` at the b...
# compose
l
I want to have a
Column
with a
Button
at the bottom and a
Text
centered between the top of the screen and top of the button. I tried two nested `Column`s, the inner one with
Modifier.fillMaxHeight()
and
Arrangement.Center
, but then the
Button
gets pushed out of the screen:
Copy code
@Preview
@Composable
private fun ColumnInColumn(modifier: Modifier = Modifier) {
    Column(Modifier.fillMaxHeight()) {
        Column(
            modifier = Modifier.fillMaxHeight(),
            verticalArrangement = Arrangement.Center,
        ) {
            Text("Hello, World!")
        }
        Button(onClick = {}) {
            Text("Button")
        }
    }
}
1
h
You can try
Modifier.weight(1f)
on the inner Column
l
Thank you, that worked!
👍 1