david.bilik
03/14/2021, 7:02 AMBox
? I have a code like this
@Preview("Positioning", widthDp = 300, heightDp = 300)
@Composable
fun Positioning() {
Box(
modifier = Modifier.size(300.dp)
.background(Color.Blue)
) {
Box(
modifier = Modifier.size(20.dp)
.background(Color.Red)
.absoluteOffset(20.dp, 20.dp)
)
}
}
and I’d like to position inner Box
but the result is not positioned. I know that it does not make sense probably to apply offset to Modifier
of inner Box
because I’d need to affect outer Box
somehow but I did not find a way how to position just a single child. I know I can achieve it easily with Canvas drawing but I’m just thinking what if I’d want to position some other Composable
. ThanksRafs
03/14/2021, 8:15 AMdavid.bilik
03/14/2021, 9:19 PM