androidx.constraintlayout.compose

Interfaces

BaselineAnchorable

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

ConstraintLayoutTagParentData
ConstraintSet

Immutable description of the constraints used to layout the children of a ConstraintLayout.

DesignInfoProvider

Interface used for Studio tooling.

Dimension

Represents a dimension that can be assigned to the width or height of a childConstrainedLayoutReference.

Dimension.Coercible

A Dimension that can be assigned both min and max bounds.

Dimension.MaxCoercible

A Dimension that can be assigned a max bound.

Dimension.MinCoercible

A Dimension that can be assigned a min bound.

HorizontalAnchorable

Represents a horizontal side of a layout (i.e top and bottom) that can be anchored using linkTo in their Modifier.constrainAs blocks.

LayoutInformationReceiver
MotionCarouselScope
MotionItemsProvider
MotionScene

Information for MotionLayout to animate between multiple ConstraintSets.

Transition

Defines interpolation parameters between two ConstraintSets.

VerticalAnchorable

Represents a vertical side of a layout (i.e start and end) that can be anchored using linkTo in their Modifier.constrainAs blocks.

Classes

Arc

Determines a specific arc direction of the widget's path on a Transition.

BaseKeyFrameScope

The base/common scope for individual KeyFrame declarations.

BaseKeyFramesScope

The base/common scope for KeyFrames.

ChainStyle

The style of a horizontal or vertical chain.

ConstrainScope

Scope that can be used to constrain a layout.

ConstrainedLayoutReference

Represents a layout within a ConstraintLayout.

ConstraintLayoutBaseScope

Common scope for ConstraintLayoutScope and ConstraintSetScope, the content being shared between the inline DSL API and the ConstraintSet-based API.

ConstraintLayoutBaseScope.BaselineAnchor

Represents a horizontal anchor corresponding to the FirstBaseline of a layout that other layouts can link to in their Modifier.constrainAs or constrain blocks.

ConstraintLayoutBaseScope.HorizontalAnchor

Represents a horizontal anchor (e.g. top/bottom of a layout, guideline) that layouts can link to in their Modifier.constrainAs or constrain blocks.

ConstraintLayoutBaseScope.VerticalAnchor

Represents a vertical anchor (e.g. start/end of a layout, guideline) that layouts can link to in their Modifier.constrainAs or constrain blocks.

ConstraintLayoutScope

Scope used by the inline DSL of ConstraintLayout.

ConstraintLayoutScope.ConstrainedLayoutReferences

Convenience API for creating multiple ConstrainedLayoutReference via createRefs.

ConstraintSetRef
ConstraintSetScope

Scope used by the ConstraintSet DSL.

ConstraintSetScope.ConstrainedLayoutReferences
CurveFit

Type of fit applied between curves.

DebugFlags

Flags to use with MotionLayout to enable visual debugging.

Easing

Supported Easing curves.

FlowStyle

Defines how widgets are spaced in a chain

GridFlag

Set of individual options that may change the Grid helper behavior, each flag can be combined with the GridFlag.or operator.

HorizontalAlign

Defines how objects align horizontally in the chain

HorizontalChainReference

Represents a horizontal chain within a ConstraintLayout.

HorizontalChainScope
InvalidationStrategy

Provide different invalidation strategies for MotionLayout.

InvalidationStrategySpecification

Helper scope that provides some strategies to improve performance based on incoming constraints.

KeyAttributeScope

Scope to define KeyFrame attributes.

KeyAttributesScope

Scope where multiple attribute KeyFrames may be defined.

KeyCycleScope

Scope to define cycling KeyFrames.

KeyCyclesScope

Scope where multiple cycling attribute KeyFrames may be defined.

KeyPositionScope

Scope to define KeyFrame positions.

KeyPositionsScope

Scope where multiple position KeyFrames may be defined.

LayoutReference

Represents a ConstraintLayout item that requires a unique identifier.

MotionLayoutScope
MotionLayoutScope.CustomProperties
MotionLayoutScope.MotionProperties
MotionSceneScope

Scope used by the MotionScene DSL.

MotionSceneScope.ConstrainedLayoutReferences
OnSwipe

Defines the OnSwipe behavior for a Transition.

RelativePosition

Relative coordinate space in which KeyPositions are applied.

Skip

Defines how many rows and/or columns to skip, starting from the given position.

Span

Defines the spanned area (that crosses multiple columns and/or rows) that a widget will take when placed at the given position.

SpringBoundary

Behavior of the spring as it crosses its target position.

State

The state of the ConstraintLayout solver.

SwipeDirection

Direction of the touch input that will initiate the swipe handling.

SwipeMode

Defines the type of motion used when animating during touch-up.

SwipeSide

Side of the bounds to track during touch handling, this is to account for when the widget changes size during the Transition.

SwipeTouchUp

The logic used to decide the target position when the touch input ends.

TransitionScope

Scope where Transition parameters are defined.

VerticalAlign

Defines how objects align vertically within the chain

VerticalChainReference

Represents a vertical chain within a ConstraintLayout.

VerticalChainScope
Visibility

The overall visibility of a widget in a ConstraintLayout.

Wrap

Wrap defines the type of chain

Objects

Annotations

Enums

LayoutInfoFlags
MotionLayoutDebugFlags
MotionLayoutFlag

This enum is deprecated. Unnecessary, MotionLayout remeasures when its content changes.

Composables

ConstraintLayout

Layout that positions its children according to the constraints between them.

ConstraintSet

Parses content into a ConstraintSet and sets the variables defined in the Variables block with the values of overrideVariables.

ItemHolder
MotionCarousel

Implements an horizontal Carousel of n elements, driven by drag gestures and customizable through a provided MotionScene.

MotionLayout

Layout that can animate between multiple ConstraintSets as defined by Transitions in the given MotionScene.

MotionScene

Parses the given JSON5 into a MotionScene.

Modifiers

layoutId

Alternative to androidx.compose.ui.layout.layoutId that enables the use of tag.

Top-level functions summary

ConstraintSet

Creates a ConstraintSet with the constraints defined in the description block.

ConstraintSet
ConstraintSet(@Language(value = "json5") jsonContent: String)

Parses the given JSON5 into a ConstraintSet.

ConstraintSet
ConstraintSet(extendConstraintSet: ConstraintSet, description: ConstraintSetScope.() -> Unit)

Creates a ConstraintSet that extends the changes applied by extendConstraintSet.

ConstraintSet
ConstraintSet(
    extendConstraintSet: ConstraintSet,
    @Language(value = "json5") jsonContent: String
)

Creates a ConstraintSet from a jsonContent string that extends the changes applied by extendConstraintSet.

MotionScene

Returns a MotionScene instance defined by motionSceneContent.

Transition
@ExperimentalMotionApi
Transition(@Language(value = "json5") content: String)

Parses the given JSON5 into a Transition.

Transition

Defines the interpolation parameters between the ConstraintSets to achieve fine-tuned animations.

Extension functions summary

Dimension.MaxCoercible

Sets the lower bound of the current Dimension to a fixed dp value.

Dimension

Sets the lower bound of the current Dimension to a fixed dp value.

Dimension

This function is deprecated. Unintended method name, use atLeast(dp) instead

Dimension.MinCoercible

Sets the upper bound of the current Dimension to a fixed dp value.

Dimension

Sets the upper bound of the current Dimension to a fixed dp value.

inline Unit
<T : Any?> MotionCarouselScope.items(
    items: List<T>,
    crossinline itemContent: @Composable (item) -> Unit
)
inline Unit
<T : Any?> MotionCarouselScope.itemsWithProperties(
    items: List<T>,
    crossinline itemContent: @Composable (item, properties: State<MotionLayoutScope.MotionProperties>) -> Unit
)

Top-level properties summary

Extension properties summary

Dimension.MaxCoercible

Sets the lower bound of the current Dimension to be the wrap content size of the child.

Dimension

Sets the lower bound of the current Dimension to be the wrap content size of the child.

Dimension.MinCoercible

Sets the upper bound of the current Dimension to be the wrap content size of the child.

Dimension

Sets the upper bound of the current Dimension to be the WRAP_DIMENSION size of the child.

Any?
Any?

Top-level functions

fun ConstraintSet(description: ConstraintSetScope.() -> Unit): ConstraintSet

Creates a ConstraintSet with the constraints defined in the description block.

See ConstraintSet to learn how to define constraints.

fun ConstraintSet(@Language(value = "json5") jsonContent: String): ConstraintSet

Parses the given JSON5 into a ConstraintSet.

See the official GitHub Wiki to learn the syntax.

fun ConstraintSet(extendConstraintSet: ConstraintSet, description: ConstraintSetScope.() -> Unit): ConstraintSet

Creates a ConstraintSet that extends the changes applied by extendConstraintSet.

See ConstraintSet to learn how to define constraints.

fun ConstraintSet(
    extendConstraintSet: ConstraintSet,
    @Language(value = "json5") jsonContent: String
): ConstraintSet

Creates a ConstraintSet from a jsonContent string that extends the changes applied by extendConstraintSet.

@ExperimentalMotionApi
fun Transition(@Language(value = "json5") content: String): Transition

Parses the given JSON5 into a Transition.

See the official GitHub Wiki to learn the syntax.

@ExperimentalMotionApi
fun Transition(from: String = "start", to: String = "end", content: TransitionScope.() -> Unit): Transition

Defines the interpolation parameters between the ConstraintSets to achieve fine-tuned animations.

Parameters
from: String = "start"

The name of the initial ConstraintSet. Should correspond to a named ConstraintSet when added as part of a MotionScene with MotionSceneScope.addTransition.

to: String = "end"

The name of the target ConstraintSet. Should correspond to a named ConstraintSet when added as part of a MotionScene with MotionSceneScope.addTransition.

content: TransitionScope.() -> Unit

Lambda to define the Transition parameters on the given TransitionScope.

Extension functions

Dimension.Coercible.atLeast

fun Dimension.Coercible.atLeast(dp: Dp): Dimension.MaxCoercible

Sets the lower bound of the current Dimension to a fixed dp value.

Dimension.MinCoercible.atLeast

fun Dimension.MinCoercible.atLeast(dp: Dp): Dimension

Sets the lower bound of the current Dimension to a fixed dp value.

Dimension.MinCoercible.atLeastWrapContent

fun Dimension.MinCoercible.atLeastWrapContent(dp: Dp): Dimension

Sets the lower bound of the current Dimension to a fixed dp value.

fun Dimension.Coercible.atMost(dp: Dp): Dimension.MinCoercible

Sets the upper bound of the current Dimension to a fixed dp value.

Dimension.MaxCoercible.atMost

fun Dimension.MaxCoercible.atMost(dp: Dp): Dimension

Sets the upper bound of the current Dimension to a fixed dp value.

inline fun <T : Any?> MotionCarouselScope.items(
    items: List<T>,
    crossinline itemContent: @Composable (item) -> Unit
): Unit

MotionCarouselScope.itemsWithProperties

inline fun <T : Any?> MotionCarouselScope.itemsWithProperties(
    items: List<T>,
    crossinline itemContent: @Composable (item, properties: State<MotionLayoutScope.MotionProperties>) -> Unit
): Unit

Top-level properties

Extension properties

Dimension.Coercible.atLeastWrapContent

val Dimension.Coercible.atLeastWrapContentDimension.MaxCoercible

Sets the lower bound of the current Dimension to be the wrap content size of the child.

Dimension.MinCoercible.atLeastWrapContent

val Dimension.MinCoercible.atLeastWrapContentDimension

Sets the lower bound of the current Dimension to be the wrap content size of the child.

Dimension.Coercible.atMostWrapContent

val Dimension.Coercible.atMostWrapContentDimension.MinCoercible

Sets the upper bound of the current Dimension to be the wrap content size of the child.

Dimension.MaxCoercible.atMostWrapContent

val Dimension.MaxCoercible.atMostWrapContentDimension

Sets the upper bound of the current Dimension to be the WRAP_DIMENSION size of the child.