tylerwilson
06/10/2021, 4:44 PMAdam Powell
06/10/2021, 5:00 PMModifier.fillMaxWidth() // consume all available width
.wrapContentWidth() // wrap within the assigned max space; centers by default
.fillMaxWidth(0.5f) // fill half of the max
other params to wrapContentWidth
can align it within the larger space any way you'd like. (start, center, end, etc.)Casey Brooks
06/10/2021, 5:03 PMweight(1f)
instead of manually determining fractional widths
Row {
// left column content
Column(modifier = Modifier.weight(1f)) {
}
// right column content
Column(modifier = Modifier.weight(1f)) {
}
}
Piotr Prus
06/10/2021, 5:06 PM@Composable
fun TestBox() {
Box(modifier = Modifier.fillMaxWidth(), contentAlignment = Alignment.TopEnd) {
Column(modifier = Modifier
.fillMaxWidth(0.5f)
.height(300.dp)) {
Surface(modifier = Modifier.fillMaxSize(), color = Color.Red) {
}
}
}
}
Piotr Prus
06/10/2021, 5:07 PMtylerwilson
06/10/2021, 5:53 PM