The Developer Preview for Android 11 is now available; test it out and share your feedback.

LayoutCoordinates

interface LayoutCoordinates
androidx.ui.core.LayoutCoordinates

A holder of the measured bounds for the layout (MeasureBox).

Summary

Public methods

abstract PxPosition

Converts a child layout position into a local position within this layout.

abstract operator IntPx?

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

abstract PxPosition

Converts a global position into a local position within this layout.

abstract PxPosition

Converts a local position within this layout into a global one.

abstract PxPosition

Converts a local position within this layout into an offset from the root composable.

Inherited extension functions

From androidx.compose
operator T

IMPORTANT: This global operator is TEMPORARY, and should be removed whenever an answer for contextual composers is reached.

Properties

abstract Boolean

Returns false if the corresponding layout was detached from the hierarchy.

abstract LayoutCoordinates?

The coordinates of the parent layout.

abstract Set<AlignmentLine>

The alignment lines provided for this layout, not including inherited lines.

abstract IntPxSize

The size of this layout in the local coordinates space.

Extension properties

From androidx.ui.core
PxBounds

The boundaries of this layout inside the root composable.

PxBounds

The global boundaries of this layout inside.

PxPosition

The global position of this layout.

PxPosition

The position of this layout inside the root composable.

From androidx.ui.test
PxPosition

Returns the position relative to the parent Layout

Public methods

childToLocal

abstract fun childToLocal(
    child: LayoutCoordinates,
    childLocal: PxPosition
): PxPosition

Converts a child layout position into a local position within this layout.

get

abstract operator fun get(line: AlignmentLine): IntPx?

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

globalToLocal

abstract fun globalToLocal(global: PxPosition): PxPosition

Converts a global position into a local position within this layout.

localToGlobal

abstract fun localToGlobal(local: PxPosition): PxPosition

Converts a local position within this layout into a global one.

localToRoot

abstract fun localToRoot(local: PxPosition): PxPosition

Converts a local position within this layout into an offset from the root composable.

Properties

isAttached

abstract val isAttached: Boolean

Returns false if the corresponding layout was detached from the hierarchy.

parentCoordinates

abstract val parentCoordinates: LayoutCoordinates?

The coordinates of the parent layout. Null if there is no parent.

providedAlignmentLines

abstract val providedAlignmentLines: Set<AlignmentLine>

The alignment lines provided for this layout, not including inherited lines.

size

abstract val size: IntPxSize

The size of this layout in the local coordinates space.