Google is committed to advancing racial equity for Black communities. See how.

ConstrainScope

class ConstrainScope
kotlin.Any
   ↳ androidx.ui.layout.ConstrainScope

Scope used by Modifier.constrainAs.

Summary

Nested classes
inner

Represents the FirstBaseline of a layout that can be anchored using linkTo in their Modifier.constrainAs blocks.

inner

Represents a horizontal side of a layout (i.

inner

Represents a vertical side of a layout (i.

Public methods
Unit

Adds start and end links towards a vertical anchor.

Unit

Adds top and bottom links towards a horizontal anchor.

Unit

Adds start and end links towards the corresponding anchors of other.

Unit

Adds all start, top, end, bottom links towards the corresponding anchors of other.

Unit

Adds top and bottom links towards the corresponding anchors of other.

Unit
linkTo(start: ConstraintLayoutBaseScope.VerticalAnchor, end: ConstraintLayoutBaseScope.VerticalAnchor, startMargin: Dp = 0.dp, endMargin: Dp = 0.dp, @FloatRange(0.0, 1.0) bias: Float = 0.5f)

Adds both start and end links towards other ConstraintLayoutBaseScope.HorizontalAnchors.

Unit
linkTo(top: ConstraintLayoutBaseScope.HorizontalAnchor, bottom: ConstraintLayoutBaseScope.HorizontalAnchor, topMargin: Dp = 0.dp, bottomMargin: Dp = 0.dp, @FloatRange(0.0, 1.0) bias: Float = 0.5f)

Adds both top and bottom links towards other ConstraintLayoutBaseScope.HorizontalAnchors.

Unit
linkTo(start: ConstraintLayoutBaseScope.VerticalAnchor, top: ConstraintLayoutBaseScope.HorizontalAnchor, end: ConstraintLayoutBaseScope.VerticalAnchor, bottom: ConstraintLayoutBaseScope.HorizontalAnchor, startMargin: Dp = 0.dp, topMargin: Dp = 0.dp, endMargin: Dp = 0.dp, bottomMargin: Dp = 0.dp, @FloatRange(0.0, 1.0) horizontalBias: Float = 0.5f, @FloatRange(0.0, 1.0) verticalBias: Float = 0.5f)

Adds all start, top, end, bottom links towards other ConstraintLayoutBaseScope.HorizontalAnchors.

Properties
ConstrainScope.VerticalAnchorable

The left anchor of the layout - can be constrained using VerticalAnchorable.linkTo.

ConstrainScope.VerticalAnchorable

The right anchor of the layout - can be constrained using VerticalAnchorable.linkTo.

ConstrainScope.BaselineAnchorable

The FirstBaseline of the layout - can be constrained using BaselineAnchorable.linkTo.

ConstrainScope.HorizontalAnchorable

The bottom anchor of the layout - can be constrained using HorizontalAnchorable.linkTo.

ConstrainScope.VerticalAnchorable

The end anchor of the layout - can be constrained using VerticalAnchorable.linkTo.

Dimension

The height of the ConstraintLayout child.

ConstrainedLayoutReference

Reference to the ConstraintLayout itself, which can be used to specify constraints between itself and its children.

ConstrainScope.VerticalAnchorable

The start anchor of the layout - can be constrained using VerticalAnchorable.linkTo.

ConstrainScope.HorizontalAnchorable

The top anchor of the layout - can be constrained using HorizontalAnchorable.linkTo.

Dimension

The width of the ConstraintLayout child.

Public methods

centerAround

fun centerAround(anchor: ConstraintLayoutBaseScope.VerticalAnchor): Unit

Adds start and end links towards a vertical anchor. This will center the current layout around the vertical anchor.

centerAround

fun centerAround(anchor: ConstraintLayoutBaseScope.HorizontalAnchor): Unit

Adds top and bottom links towards a horizontal anchor. This will center the current layout around the horizontal anchor.

centerHorizontallyTo

fun centerHorizontallyTo(other: ConstrainedLayoutReference): Unit

Adds start and end links towards the corresponding anchors of other. This will center horizontally the current layout inside or around (depending on size) other.

centerTo

fun centerTo(other: ConstrainedLayoutReference): Unit

Adds all start, top, end, bottom links towards the corresponding anchors of other. This will center the current layout inside or around (depending on size) other.

centerVerticallyTo

fun centerVerticallyTo(other: ConstrainedLayoutReference): Unit

Adds top and bottom links towards the corresponding anchors of other. This will center vertically the current layout inside or around (depending on size) other.

linkTo

fun linkTo(
    start: ConstraintLayoutBaseScope.VerticalAnchor,
    end: ConstraintLayoutBaseScope.VerticalAnchor,
    startMargin: Dp = 0.dp,
    endMargin: Dp = 0.dp,
    @FloatRange(0.0, 1.0) bias: Float = 0.5f
): Unit

Adds both start and end links towards other ConstraintLayoutBaseScope.HorizontalAnchors.

linkTo

fun linkTo(
    top: ConstraintLayoutBaseScope.HorizontalAnchor,
    bottom: ConstraintLayoutBaseScope.HorizontalAnchor,
    topMargin: Dp = 0.dp,
    bottomMargin: Dp = 0.dp,
    @FloatRange(0.0, 1.0) bias: Float = 0.5f
): Unit

Adds both top and bottom links towards other ConstraintLayoutBaseScope.HorizontalAnchors.

linkTo

fun linkTo(
    start: ConstraintLayoutBaseScope.VerticalAnchor,
    top: ConstraintLayoutBaseScope.HorizontalAnchor,
    end: ConstraintLayoutBaseScope.VerticalAnchor,
    bottom: ConstraintLayoutBaseScope.HorizontalAnchor,
    startMargin: Dp = 0.dp,
    topMargin: Dp = 0.dp,
    endMargin: Dp = 0.dp,
    bottomMargin: Dp = 0.dp,
    @FloatRange(0.0, 1.0) horizontalBias: Float = 0.5f,
    @FloatRange(0.0, 1.0) verticalBias: Float = 0.5f
): Unit

Adds all start, top, end, bottom links towards other ConstraintLayoutBaseScope.HorizontalAnchors.

Properties

absoluteLeft

val absoluteLeft: ConstrainScope.VerticalAnchorable

The left anchor of the layout - can be constrained using VerticalAnchorable.linkTo.

absoluteRight

val absoluteRight: ConstrainScope.VerticalAnchorable

The right anchor of the layout - can be constrained using VerticalAnchorable.linkTo.

baseline

val baseline: ConstrainScope.BaselineAnchorable

The FirstBaseline of the layout - can be constrained using BaselineAnchorable.linkTo.

bottom

val bottom: ConstrainScope.HorizontalAnchorable

The bottom anchor of the layout - can be constrained using HorizontalAnchorable.linkTo.

end

val end: ConstrainScope.VerticalAnchorable

The end anchor of the layout - can be constrained using VerticalAnchorable.linkTo.

height

var height: Dimension

The height of the ConstraintLayout child.

parent

val parent: ConstrainedLayoutReference

Reference to the ConstraintLayout itself, which can be used to specify constraints between itself and its children.

start

val start: ConstrainScope.VerticalAnchorable

The start anchor of the layout - can be constrained using VerticalAnchorable.linkTo.

top

val top: ConstrainScope.HorizontalAnchorable

The top anchor of the layout - can be constrained using HorizontalAnchorable.linkTo.

width

var width: Dimension

The width of the ConstraintLayout child.