Understanding the single measure pass
Laying out a UI element hierarchy means determining the sizes of all the elements and positioning them on the screen based on the layout strategy of their parent. At first, getting the size of, say, some text doesn’t sound too complicated. After all, isn’t it determined by the font and the text to be output? Here’s an example, with two pieces of text laid out in a Column()
:
@Composable @Preview fun ColumnWithTexts() { Column { Text( text = "Android UI development with Jetpack Compose", style = MaterialTheme.typography.headlineMedium, ) Text( text = "Hello Compose", style = MaterialTheme .typography.headlineSmall ...