androidx.compose.ui.layout
MeasureScope
Interface · from org.jetbrains.compose.ui:ui:1.12.2
No hand-written docs yet.
The receiver scope of a layout's measure lambda. The return value of the measure lambda is MeasureResult, which should be returned by layout
interface MeasureScope : IntrinsicMeasureScope
Is a
Kinds of MeasureScope
Anywhere a MeasureScope is expected, you can pass any of these.
ApproachMeasureScopeuiLazyLayoutMeasureScopefoundationSubcomposeMeasureScopeui
How to get one
Or create one of the kinds listed above.
Used by
Parameters that take a MeasureScope.
layout(measure)TabIndicatorScope.tabIndicatorLayout(measure)
Functions
layout
fun layout(
width: Int,
height: Int,
alignmentLines: Map<AlignmentLine, Int> = emptyMap(),
placementBlock: Placeable.PlacementScope.() -> Unit,
)
Sets the size and alignment lines of the measured layout, as well as the positioning block that defines the children positioning logic. The placementBlock is a lambda used for positioning children. Placeable.placeAt should be called on children inside placementBlock. The alignmentLines can be used by the parent layouts to decide layout, and can be queried using the Placeable.get operator. Note that alignment lines will be inherited by parent layouts, such that indirect parents will be able to query them as well.
fun layout(
width: Int,
height: Int,
alignmentLines: Map<AlignmentLine, Int> = emptyMap(),
rulers: (RulerScope.() -> Unit)? = null,
placementBlock: Placeable.PlacementScope.() -> Unit,
): MeasureResult
Sets the size and alignment lines of the measured layout, as well as the positioning block that defines the children positioning logic. The placementBlock is a lambda used for positioning children. Placeable.placeAt should be called on children inside placementBlock. The alignmentLines can be used by the parent layouts to decide layout, and can be queried using the Placeable.get operator. Note that alignment lines will be inherited by parent layouts, such that indirect parents will be able to query them as well.
fun layout(
width: Int,
height: Int,
isRulerProvided: (Ruler) -> Boolean,
rulerProvider: RulerScope.(Ruler) -> Unit,
alignmentLines: Map<AlignmentLine, Int> = emptyMap(),
placementBlock: Placeable.PlacementScope.() -> Unit,
): MeasureResult
Sets the size and alignment lines of the measured layout, as well as the positioning block that defines the children positioning logic. The placementBlock is a lambda used for positioning children. Placeable.placeAt should be called on children inside placementBlock. The alignmentLines can be used by the parent layouts to decide layout, and can be queried using the Placeable.get operator. Note that alignment lines will be inherited by parent layouts, such that indirect parents will be able to query them as well.
Library docs
The receiver scope of a layout's measure lambda. The return value of the measure lambda is
MeasureResult, which should be returned by layout