Joseph Cheng
01/19/2020, 1:50 PMsetContent {
MaterialTheme {
ColoredRect(color = Color.Blue, width = 100.dp, height = 50.dp)
}
}
But once I put a Container as the parent, it works as expected. May I know why?
setContent {
MaterialTheme {
Container {
ColoredRect(color = Color.Blue, width = 100.dp, height = 50.dp)
}
}
}Klaas Kabini
01/19/2020, 4:08 PMMihai Popa
01/20/2020, 11:31 AMContainer this will fill the screen and the ColoredRect will be able to use its desired sizeJoseph Cheng
01/20/2020, 4:32 PMMihai Popa
01/20/2020, 5:11 PMonMeasure the AndroidComposeView with MeasureSpec.EXACTLY which we then translate to fixed constraints in the Compose hierarchy, determining the root of the layout hierarchy to be forced due to constraints to fill the whole screenMihai Popa
01/20/2020, 5:13 PMContainer.kt that it will looseMin the constraints before measuring its children, so its children will not be forced anymore to fill the whole screenJoseph Cheng
01/21/2020, 5:43 PM