← Back to Foundation Layout
Column
Component
in
Foundation Layout
. Since 0.1.0-dev15
Overview
Examples
Community Notes
Video
@Composable
fun SimpleColumn() {
Column {
// The child with no weight will have the specified size.
Box(Modifier.size(40.dp, 80.dp).background(Color.Magenta))
// Has weight, the child will occupy half of the remaining height.
Box(Modifier.width(40.dp).weight(1f).background(Color.Yellow))
// Has weight and does not fill, the child will occupy at most half of the remaining height.
// Therefore it will occupy 80.dp (its preferred height) if the assigned height is larger.
Box(
Modifier.size(40.dp, 80.dp)
.weight(1f, fill = false)
.background(Color.Green)
)
}
}
Previous Component← BoxWithConstraints
Next ComponentConstraintLayout →