Alignment and Arrangement
Position children precisely.
Alignment and Arrangement is a free Android Academy lesson on CoddyKit — lesson 3 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Android Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Positioning Children
Inside a Column or Row, two settings control where children sit: alignment (across the layout) and arrangement (along the layout).
Column Alignment
In a Column, children stack vertically. horizontalAlignment controls their horizontal position — left, center, or right.
Column(horizontalAlignment = Alignment.CenterHorizontally) {
Text("Centered")
Text("Also centered")
}Column Arrangement
verticalArrangement controls how children are spread vertically — top, center, bottom, or evenly spaced.
Column(verticalArrangement = Arrangement.Center) {
Text("A")
Text("B")
}Row Alignment
In a Row, the axes flip. verticalAlignment controls the children's vertical position, and horizontalArrangement spreads them horizontally.
Row(verticalAlignment = Alignment.CenterVertically) {
Text("Left")
Text("Right")
}Remembering the Pair
Tip: alignment is the cross axis, arrangement is the main axis. In a Column the main axis is vertical, so verticalArrangement and horizontalAlignment.
Arrangement Options
Common Arrangement values:
Top/Bottom/CenterSpaceBetween— gaps between items.SpaceAround/SpaceEvenly
SpaceBetween
SpaceBetween pushes the first and last children to the edges and distributes the rest evenly — perfect for a top bar with a title on the left and an icon on the right.
Row(horizontalArrangement = Arrangement.SpaceBetween) {
Text("Title")
Text("Action")
}Arrangement.spacedBy
Arrangement.spacedBy(8.dp) adds a fixed gap between every child — the cleanest way to space list items evenly.
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
Text("One")
Text("Two")
Text("Three")
}Combine spacedBy with Alignment
You can combine arrangement and alignment together for full control of layout.
Column(
verticalArrangement = Arrangement.spacedBy(12.dp),
horizontalAlignment = Alignment.CenterHorizontally
) {
Text("Title")
Button(onClick = {}) { Text("Go") }
}Box Alignment
For Box, use contentAlignment to position children, or Modifier.align() on individual children for per-child placement.
Box(modifier = Modifier.fillMaxSize()) {
Text(
text = "Bottom",
modifier = Modifier.align(Alignment.BottomCenter)
)
}Putting It Together
A header row plus an evenly spaced list.
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
Row(horizontalArrangement = Arrangement.SpaceBetween) {
Text("Inbox")
Text("Edit")
}
Text("Message 1")
Text("Message 2")
}Quick Check
In a Column, which parameter controls the children's horizontal position?
Recap
Positioning:
- Alignment = cross axis; arrangement = main axis.
- Column:
horizontalAlignment+verticalArrangement. - Row:
verticalAlignment+horizontalArrangement. Arrangement.spacedBy()adds even gaps.
Frequently asked questions
Is the “Alignment and Arrangement” lesson free?
Yes — the full text of “Alignment and Arrangement” is free to read here on the web, and the Android Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Android Academy course, upgrade to CoddyKit PRO.
What will I learn in “Alignment and Arrangement”?
Position children precisely. You practise Android Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Android Academy?
No prior experience is required. Android Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 3 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Alignment and Arrangement” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Android Academy lesson?
Yes. Every Android Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Column, Row, and Box
- The Modifier System
- Alignment and Arrangement
- Lists with LazyColumn