Alignment and Arrangement
Position children precisely.
Alignment and Arrangement is a free Android Academy lesson on CoddyKit. This is lesson 3 of 4. Any 3 lessons of this learning path are free to read in full — after that, CoddyKit PRO unlocks every lesson, plus hands-on practice with a built-in code editor and a 24/7 AI tutor. It is part of the Android Academy learning path, and your progress syncs across the web and the CoddyKit app. The Android Academy course includes 4 lessons in total.
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.
Learn Kotlin with an AI tutor — free
Write and run real code in your browser, get instant help from a 24/7 AI tutor, and pick up where you left off on the web or in the app.
- Courses
- 36
- Lessons
- 152
Frequently Asked Questions
Is the “Alignment and Arrangement” lesson free?
Yes — any 3 lessons of the Android Academy learning path, including “Alignment and Arrangement”, are free to read in full here on the web. After that, CoddyKit PRO unlocks every lesson, plus interactive practice with a built-in code editor and a 24/7 AI tutor. The Android Academy course includes 4 lessons in total.
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, so you can start here or from the beginning and move at your own pace. This is lesson 3 of 4.
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