Sergey B
05/17/2021, 4:06 PMSergey B
05/17/2021, 4:06 PM@Composable
fun MyComposable() {
Box(
modifier = Modifier
.size(100.dp)
.background(Color.LightGray)
.offset(10.dp, (-10).dp),
contentAlignment = Alignment.TopStart
) {
Box(
modifier = Modifier
.size(300.dp)
.background(Color.DarkGray),
contentAlignment = Alignment.TopStart
) {
Text(text = "test")
}
}
}
Sergey B
05/17/2021, 4:06 PMZach Klippenstein (he/him) [MOD]
05/17/2021, 4:54 PMbackground
modifier simply only draws within its bounds. If you want to change the bounds used for the background modifier, change its position in the modifier chain.Sergey B
05/17/2021, 5:32 PMrequiredHeight
instead. The height
modifier declares the preferred height and can be overridden by incoming measurement constraints. Thanks for your help Zach