{% setvar book_path %}/reference/kotlin/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

MeasureScope

Known direct subclasses
IntermediateMeasureScope

IntermediateMeasureScope provides access to lookahead results to allow intermediateLayout to leverage lookahead results to define intermediate measurements and placements to gradually converge with lookahead.

LazyLayoutMeasureScope

The receiver scope of a LazyLayout's measure lambda.

SubcomposeMeasureScope

The receiver scope of a SubcomposeLayout's measure lambda which adds ability to dynamically subcompose a content during the measuring on top of the features provided by MeasureScope.

Known indirect subclasses
SubcomposeIntermediateMeasureScope

SubcomposeIntermediateMeasureScope is the receiver scope for the intermediate measurer policy that gets invoked during the intermediate measure pass.


The receiver scope of a layout's measure lambda. The return value of the measure lambda is MeasureResult, which should be returned by layout

Summary

Public functions

open MeasureResult
layout(
    width: Int,
    height: Int,
    alignmentLines: Map<AlignmentLineInt>,
    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.

Cmn

Inherited functions

From androidx.compose.ui.unit.Density
open Int

Convert Dp to Int by rounding

Cmn
open Int

Convert Sp to Int by rounding

Cmn
open Dp

Convert Sp to Dp.

Cmn
open Dp

Convert an Int pixel value to Dp.

Cmn
open Dp

Convert a Float pixel value to a Dp

Cmn
open DpSize

Convert a Size to a DpSize.

Cmn
open Float

Convert Dp to pixels.

Cmn
open Float

Convert Sp to pixels.

Cmn
open Rect

Convert a DpRect to a Rect.

Cmn
open Size

Convert a DpSize to a Size.

Cmn
open TextUnit

Convert Dp to Sp.

Cmn
open TextUnit

Convert an Int pixel value to Sp.

Cmn
open TextUnit

Convert a Float pixel value to a Sp

Cmn

Inherited properties

From androidx.compose.ui.unit.Density
Float

The logical density of the display.

Cmn
Float

Current user preference for the scaling factor for fonts.

Cmn
From androidx.compose.ui.layout.IntrinsicMeasureScope
open Boolean

This indicates whether the ongoing measurement is for lookahead pass.

Cmn
LayoutDirection

The LayoutDirection of the Layout or LayoutModifier using the measure scope to measure their children.

Cmn

Public functions

layout

open fun layout(
    width: Int,
    height: Int,
    alignmentLines: Map<AlignmentLineInt> = 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.

Parameters
width: Int

the measured width of the layout

height: Int

the measured height of the layout

alignmentLines: Map<AlignmentLineInt> = emptyMap()

the alignment lines defined by the layout

placementBlock: Placeable.PlacementScope.() -> Unit

block defining the children positioning of the current layout