PlacementScope

sealed class PlacementScope

The receiver a MeasureResult places its children in, from a MeasurePolicy or a LayoutModifierNode.

A placement is relative to the container's inner rectangle - inside its insets - so a policy works in the same coordinates it measured in.

Properties

Link copied to clipboard
abstract val isLeftToRight: Boolean

Whether the container reads left to right; see java.awt.ComponentOrientation.

Link copied to clipboard
abstract val parentWidth: Int

The inner width the policy divided, which is what placeRelative mirrors a placement across.

Functions

Link copied to clipboard
abstract fun Placeable.place(x: Int, y: Int, zIndex: Float = 0.0f)

Places the child at x from the left edge, whatever the orientation.

Link copied to clipboard
open fun Placeable.placeRelative(x: Int, y: Int, zIndex: Float = 0.0f)

Places the child at x from the leading edge, mirroring under a right-to-left parent.

Link copied to clipboard
open fun Placeable.placeRelativeWithLayer(x: Int, y: Int, zIndex: Float = 0.0f, layerBlock: PlacementLayerScope.() -> Unit = DefaultLayerBlock)

Places the child at x from the leading edge, mirroring under a right-to-left parent, with a layer whose properties layerBlock sets; see placeWithLayer.

Link copied to clipboard
open fun Placeable.placeWithLayer(x: Int, y: Int, zIndex: Float = 0.0f, layerBlock: PlacementLayerScope.() -> Unit = DefaultLayerBlock)

Places the child at x from the left edge, whatever the orientation, with a layer whose properties layerBlock sets, as androidx's placeWithLayer does. Placing the child without a layer on a later pass removes the layer.