alorma
07/09/2021, 8:16 AMLayout(
modifier = modifier,
content = content
) { measurables, constraints ->
// Don't constrain child views further, measure them with given constraints
// List of measured children
val placeables = measurables.map { measurable ->
// Measure each child
measurable.measure(constraints)
}
}
But, with RC01, whenever I try to import and create one, Layout
has a new parameter called measurePolicy: MeasurePolicy
... what should we do with this one?Albert Chang
07/09/2021, 8:32 AMMeasurePolicy
is the lambda ({ measurables, constraints -> ... }
).alorma
07/09/2021, 8:35 AMalorma
07/09/2021, 8:35 AMalorma
07/09/2021, 8:35 AMManuel Vivo
07/09/2021, 9:59 AMMeasurePolicy
objects, for example when needing more information about the children. We added a new example in the Intrinsic measurements Layouts doc: https://developer.android.com/jetpack/compose/layouts/intrinsic-measurements#intrinsics-in-layouts
In there, apart from measure
, you need to override some intrinsics methods if you want to provide a custom impl when the default is not good enough for your custom layout/modifier