androidx.compose.ui.layout

MeasureResult

Interface · from org.jetbrains.compose.ui:ui:1.12.2

No hand-written docs yet.

Interface holding the size and alignment lines of the measured layout, as well as the children positioning logic. placeChildren is the function used for positioning children. Placeable.placeAt should be called on children inside placeChildren. The alignment lines 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.

interface MeasureResult

How to get one

Ready-made values and functions that return it

Properties

width

val width: Int

The measured width of the layout, in pixels.

height

val height: Int

The measured height of the layout, in pixels.

alignmentLines

val alignmentLines: Map<AlignmentLine, Int>

Alignment lines that can be used by parents to align this layout. This only includes the alignment lines of this layout and not children.

rulers

val rulers: (RulerScope.() -> Unit)?

An optional lambda function used to create Rulers for child layout. This may be reevealuated when the layout's position moves.

isRulerProvidedSince 1.12

val isRulerProvided: ((Ruler) -> Boolean)?

Works in conjunction with rulerProvider to provide``RulerScope.provides Ruler values individually. A return value of true indicates that rulerProvider might be able to provide a value for the passed-in Ruler. A value of false means it can never provide the value.

rulerProviderSince 1.12

val rulerProvider: (RulerScope.(Ruler) -> Unit)?

A lambda that can provide``RulerScope.provides Ruler values. When isRulerProvided returns true for a Ruler, rulerProvider will be called to provide its value. rulerProvider can choose not to provide the value if it isn't available. It can also provide more Ruler values if it is convenient to provide them. For example, it may be convenient to provide all values for a RectRulers when one is provided.

Functions

placeChildren

fun placeChildren()

A method used to place children of this layout. It may also be used to measure children that were not needed for determining the size of this layout.

Library docs

Interface holding the size and alignment lines of the measured layout, as well as the children positioning logic. placeChildren is the function used for positioning children. Placeable.placeAt should be called on children inside placeChildren. The alignment lines 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.