The Measure & Place Model
Understand Compose's single-pass layout.
The Measure & Place Model is a free Jetpack Compose Academy lesson on CoddyKit — lesson 1 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 Jetpack Compose Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
When Built-In Layouts Are Not Enough
Column, Row, and Box cover most screens. But sometimes you need total control over where children go. That is when you build a custom layout. 🎨
Compose Lays Out in One Pass
Unlike the old View system, Compose measures and places everything in a single pass. There is no expensive measure-then-measure-again cycle.
Two Steps: Measure, Then Place
Every layout does two things in order. First it measures each child to learn its size. Then it places each child at a chosen position.
Measurables Are Children Not Yet Sized
A parent receives its children as measurables. A measurable is a child you have not measured yet, like a parcel before you weigh it. 📦
Measuring Produces a Placeable
Call measure on a measurable and you get a placeable back. The placeable knows its final width and height and is ready to be positioned.
val placeable = measurable.measure(constraints)
val w = placeable.widthConstraints Set the Size Limits
When you measure, you pass constraints: the min and max width and height the child is allowed. The child picks a size within those bounds.
Measure Each Child Exactly Once
The single-pass rule means you must measure each child only once. Measuring the same child twice throws an error at runtime.
The Parent Decides Its Own Size
After measuring children, the parent reports its own width and height. It usually sizes itself to wrap the children it just measured.
layout(width, height) {
// place children here
}Placing Sets Each Child's Position
Inside the layout block you call placeRelative on each placeable, giving it an x and y. That is where the child lands on screen.
placeable.placeRelative(x = 0, y = 0)placeRelative Respects Direction
Prefer placeRelative over place. It automatically mirrors positions for right-to-left languages, so your layout works everywhere. 🌍
This Model Powers Every Layout
Column, Row, and your future custom layouts all follow this same measure-then-place rhythm. Learn it once and you understand all of Compose layout.
Quick Check
What do you get back after measuring a measurable?
Recap: The Measure & Place Model
Compose lays out in one pass: measure each child once within constraints to get placeables, then place them. This model drives every layout you will build. ✅
Frequently asked questions
Is the “The Measure & Place Model” lesson free?
Yes — the full text of “The Measure & Place Model” is free to read here on the web, and the Jetpack Compose 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 Jetpack Compose Academy course, upgrade to CoddyKit PRO.
What will I learn in “The Measure & Place Model”?
Understand Compose's single-pass layout. You practise Jetpack Compose 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 Jetpack Compose Academy?
No prior experience is required. Jetpack Compose Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “The Measure & Place Model” 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 Jetpack Compose Academy lesson?
Yes. Every Jetpack Compose 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
- The Measure & Place Model
- Writing a Layout Composable
- Constraints & Intrinsic Measurements
- A FlowRow That Wraps Chips