Question about layout constraints: I'm trying to c...
# compose
t
Question about layout constraints: I'm trying to constrain one layout in a Column between a min and max size, but let it expand and contract with the available space in the parent.
Copy code
@Preview
@Composable
fun CollapsingHeaderPreview() {
    Column(
        Modifier
            .background(Color.White)
            .height(176.dp)
    ) {
        Box(
            Modifier
                .heightIn(56.dp, 128.dp)
                .fillMaxWidth()
                .background(Color.Red.copy(alpha = 0.5f))
        )
        Box(
            Modifier
                .height(48.dp)
                .fillMaxWidth()
                .background(Color.Green.copy(alpha = 0.5f))
        )
    }
}
If I use
weight
in the first
Box
, it disregards
heightIn
and fills the remaining space regardless.
a
Try changing
fillMaxWidth()
on the first
Box
to
fillMaxSize()
?
t
Yep, that's it. Thanks!