Placeable


A Placeable corresponds to a child layout that can be positioned by its parent layout. Most Placeables are the result of a Measurable.measure call.

A Placeable should never be stored between measure calls.

Summary

Nested types

Receiver scope that permits explicit placement of a Placeable.

Public constructors

Cmn

Protected functions

abstract Unit
placeAt(position: IntOffset, zIndex: Float, layerBlock: (GraphicsLayerScope.() -> Unit)?)

Place a Placeable at position in its parent's coordinate system.

Cmn
open Unit
placeAt(position: IntOffset, zIndex: Float, layer: GraphicsLayer)

Place a Placeable at position in its parent's coordinate system.

Cmn

Public properties

Int

The height, in pixels, of the measured layout, as seen by the parent.

Cmn
open Int

The measured height of the layout.

Cmn
open Int

The measured width of the layout.

Cmn
Int

The width, in pixels, of the measured layout, as seen by the parent.

Cmn

Protected properties

IntOffset

The offset to be added to an apparent position assigned to this Placeable to make it real.

Cmn
IntSize

The measured size of this Placeable.

Cmn
Constraints

The constraints used for the measurement made to obtain this Placeable.

Cmn

Inherited functions

From androidx.compose.ui.layout.Measured
abstract operator Int
get(alignmentLine: AlignmentLine)

Returns the position of an alignment line, or AlignmentLine.Unspecified if the line is not provided.

Cmn

Inherited properties

From androidx.compose.ui.layout.Measured
open Any?

Data provided by the ParentDataModifier applied to the layout.

Cmn

Public constructors

Placeable

Placeable()

Protected functions

placeAt

protected abstract fun placeAt(position: IntOffset, zIndex: Float, layerBlock: (GraphicsLayerScope.() -> Unit)?): Unit

Place a Placeable at position in its parent's coordinate system.

Parameters
position: IntOffset

position in the parent's coordinate system.

zIndex: Float

controls the drawing order for the Placeable. A Placeable with larger zIndex will be drawn on top of all the children with smaller zIndex. When children have the same zIndex the order in which the items were placed is used.

layerBlock: (GraphicsLayerScope.() -> Unit)?

when non-null this Placeable should be placed with an introduced graphic layer. You can configure any layer property available on GraphicsLayerScope via this block. Also if the Placeable will be placed with a new position next time only the graphic layer will be moved without requiring to redrawn the Placeable content.

placeAt

protected open fun placeAt(position: IntOffset, zIndex: Float, layer: GraphicsLayer): Unit

Place a Placeable at position in its parent's coordinate system.

Parameters
position: IntOffset

position in the parent's coordinate system.

zIndex: Float

controls the drawing order for the Placeable. A Placeable with larger zIndex will be drawn on top of all the children with smaller zIndex. When children have the same zIndex the order in which the items were placed is used.

layer: GraphicsLayer

GraphicsLayer to place this placeable with. If the Placeable will be placed with a new position next time only the graphic layer will be moved without requiring to redrawn the Placeable content.

Public properties

height

val heightInt

The height, in pixels, of the measured layout, as seen by the parent. This will usually coincide with the measured height of the layout (aka the height value passed into MeasureScope.layout), but can be different if the layout does not respect its incoming constraints: in these cases the height will be coerced inside the min and max height constraints - to access the actual height that the layout measured itself to, use measuredHeight.

measuredHeight

open val measuredHeightInt

The measured height of the layout. This might not respect the measurement constraints.

measuredWidth

open val measuredWidthInt

The measured width of the layout. This might not respect the measurement constraints.

width

val widthInt

The width, in pixels, of the measured layout, as seen by the parent. This will usually coincide with the measured width of the layout (aka the width value passed into MeasureScope.layout), but can be different if the layout does not respect its incoming constraints: in these cases the width will be coerced inside the min and max width constraints - to access the actual width that the layout measured itself to, use measuredWidth.

Protected properties

apparentToRealOffset

protected val apparentToRealOffsetIntOffset

The offset to be added to an apparent position assigned to this Placeable to make it real. The real layout will be centered on the space assigned by the parent, which computed the child's position only seeing its apparent size.

measuredSize

protected var measuredSizeIntSize

The measured size of this Placeable. This might not respect measurementConstraints.

measurementConstraints

protected var measurementConstraintsConstraints

The constraints used for the measurement made to obtain this Placeable.