Skip to content

RowColumnMeasurePolicy

abstract class RowColumnMeasurePolicy(
    val sumWidth: Boolean = false, 
    val sumHeight: Boolean = false, 
    val arrangementSpacing: Int = 0
) : MeasurePolicy

Base MeasurePolicy for Row and Column layouts.

Handles sequential measurement (subtracting consumed space when sumWidth or sumHeight is true) and delegates child placement to placeChildren.

Parameters

  • sumWidth: When true, each child's width is subtracted from the remaining max-width before the next child is measured (Row behaviour).

  • sumHeight: When true, each child's height is subtracted from the remaining max-height before the next child is measured (Column behaviour).

  • arrangementSpacing: Additional pixels added between siblings by the arrangement.

Constructors

RowColumnMeasurePolicy

constructor(
    sumWidth: Boolean = false, 
    sumHeight: Boolean = false, 
    arrangementSpacing: Int = 0
)

Parameters

  • sumWidth: When true, each child's width is subtracted from the remaining max-width before the next child is measured (Row behaviour).

  • sumHeight: When true, each child's height is subtracted from the remaining max-height before the next child is measured (Column behaviour).

  • arrangementSpacing: Additional pixels added between siblings by the arrangement.

Properties

arrangementSpacing

Parameters

  • arrangementSpacing: Additional pixels added between siblings by the arrangement.

sumHeight

Parameters

  • sumHeight: When true, each child's height is subtracted from the remaining max-height before the next child is measured (Column behaviour).

sumWidth

Parameters

  • sumWidth: When true, each child's width is subtracted from the remaining max-width before the next child is measured (Row behaviour).

Functions

measure

open override fun measure(
    scope: MeasureScope, 
    measurables: List<Measurable>, 
    constraints: Constraints
): MeasureResult

Measures measurables within constraints and returns a MeasureResult.

Parameters

  • scope: The LayoutNode currently being measured (implements MeasureScope).

  • measurables: The child nodes to measure.

  • constraints: The size constraints imposed by the parent.

placeChildren

abstract fun placeChildren(
    scope: MeasureScope, 
    measurables: List<Measurable>, 
    placeables: List<Placeable>, 
    width: Int, 
    height: Int
): MeasureResult

Positions all measured placeables within width × height and returns the MeasureResult.

Parameters

  • scope: The measuring LayoutNode.

  • measurables: The original measurables (for modifier access).

  • placeables: The measured placeables to position.

  • width: The resolved container width.

  • height: The resolved container height.