Compose has three core layout composables: Column (vertical), Row (horizontal) and Box (overlapping/stacked).
Column(
verticalArrangement = Arrangement.spacedBy(8.dp),
horizontalAlignment = Alignment.Start
) {
Text("Title", style = MaterialTheme.typography.titleLarge)
Row(verticalAlignment = Alignment.CenterVertically) {
Icon(Icons.Default.Star, contentDescription = null)
Spacer(Modifier.width(4.dp))
Text("4.8")
Spacer(Modifier.weight(1f)) // pushes price to the end
Text("\u20B9499")
}
}
Arrangementcontrols spacing along the main axis.Alignmentcontrols the cross axis.Spacer(Modifier.weight(1f))fills leftover space.Boxstacks children; useModifier.align()to position them.
Tip: Most screens are just nested Columns and Rows — combine them freely.
Summary
Column, Row and Box are the building blocks of Compose layout. Control spacing with Arrangement/Alignment and fill space with weight.