Thread
#compose
    a

    alorma

    1 year ago
    Hi. On the layout codelab it shows this to create a new custom layout:
    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?
    Albert Chang

    Albert Chang

    1 year ago
    MeasurePolicy
    is the lambda (
    { measurables, constraints -> ... }
    ).
    a

    alorma

    1 year ago
    aaaaaaaaaaaaaaah
    make sense
    thanks
    Manuel Vivo

    Manuel Vivo

    1 year ago
    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