Hi. On the layout codelab it shows this to create...
# compose
a
Hi. On the layout codelab it shows this to create a new custom layout:
Copy code
Layout(
        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?
a
MeasurePolicy
is the lambda (
{ measurables, constraints -> ... }
).
a
aaaaaaaaaaaaaaah
make sense
thanks
m
Yup! You can also create your own
MeasurePolicy
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