My question is related to this one: How to achieve this layout in Jetpack Compose
I have this code:
@Composable
fun TestUi() {
Row {
Box(
contentAlignment = Alignment.Center,
modifier = Modifier
.background(color = Color.Yellow)
.fillMaxHeight()
) {
CircularProgressIndicator()
}
Image(imageVector = vectorResource(id = R.drawable.ic_launcher_background))
}
}
I expected to get this:
But I got this instead:
How can I get the Box to fill all the available height without affecting the height of the Row?
I know I could use a ConstraintLayout to solve this, but it seems too much for such a simple use case.
This worked for me Modifier.height(IntrinsicSize.Min)
@Composable
fun content() {
return Row(
modifier = Modifier
.height(IntrinsicSize.Min)
) {
Box(
modifier = Modifier
.width(8.dp)
.fillMaxHeight()
.background(Color.Red)
)
Column {
Text("Hello")
Text("World")
}
}
}
source: https://www.rockandnull.com/jetpack-compose-fillmaxheight-fillmaxwidth/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With