public class

ConstraintLayout.LayoutParams

extends ViewGroup.MarginLayoutParams

 java.lang.Object

↳ViewGroup.MarginLayoutParams

↳androidx.constraintlayout.widget.ConstraintLayout.LayoutParams

Subclasses:

Constraints.LayoutParams

Overview

This class contains the different attributes specifying how a view want to be laid out inside a ConstraintLayout. For building up constraints at run time, using ConstraintSet is recommended.

Summary

Fields
public static final intBASELINE

The baseline of the text in a view.

public intbaselineMargin

The baseline margin.

public intbaselineToBaseline

Constrains the baseline of a child to the baseline of a target child (contains the target child id).

public intbaselineToBottom

Constrains the baseline of a child to the bottom of a target child (contains the target child id).

public intbaselineToTop

Constrains the baseline of a child to the top of a target child (contains the target child id).

public static final intBOTTOM

The bottom side of a view.

public intbottomToBottom

Constrains the bottom side of a child to the bottom side of a target child (contains the target child id).

public intbottomToTop

Constrains the bottom side of a child to the top side of a target child (contains the target child id).

public static final intCHAIN_PACKED

Chain packed style

public static final intCHAIN_SPREAD

Chain spread style

public static final intCHAIN_SPREAD_INSIDE

Chain spread inside style

public static final intCIRCLE

Circle reference from a view.

public floatcircleAngle

The angle used for a circular constraint]

public intcircleConstraint

Constrains the center of a child to the center of a target child (contains the target child id).

public intcircleRadius

The radius used for a circular constraint

public booleanconstrainedHeight

Specify if the vertical dimension is constrained in case both top & bottom constraints are set and the widget dimension is not a fixed dimension.

public booleanconstrainedWidth

Specify if the horizontal dimension is constrained in case both left & right constraints are set and the widget dimension is not a fixed dimension.

public java.lang.StringconstraintTag

Define a category of view to be used by helpers and motionLayout

public java.lang.StringdimensionRatio

The ratio information.

public inteditorAbsoluteX

The design time location of the left side of the child.

public inteditorAbsoluteY

The design time location of the right side of the child.

public static final intEND

The right side of a view in right to left languages.

public intendToEnd

Constrains the end side of a child to the end side of a target child (contains the target child id).

public intendToStart

Constrains the end side of a child to the start side of a target child (contains the target child id).

public static final intGONE_UNSET

Defines an id that is not set.

public intgoneBaselineMargin

The baseline margin to use when the target is gone.

public intgoneBottomMargin

The bottom margin to use when the target is gone.

public intgoneEndMargin

The end margin to use when the target is gone.

public intgoneLeftMargin

The left margin to use when the target is gone.

public intgoneRightMargin

The right margin to use when the target is gone

public intgoneStartMargin

The start margin to use when the target is gone.

public intgoneTopMargin

The top margin to use when the target is gone.

public intguideBegin

The distance of child (guideline) to the top or left edge of its parent.

public intguideEnd

The distance of child (guideline) to the bottom or right edge of its parent.

public booleanguidelineUseRtl

The ratio of the distance to the parent's sides

public floatguidePercent

The ratio of the distance to the parent's sides

public booleanhelped

public static final intHORIZONTAL

The horizontal orientation.

public floathorizontalBias

The ratio between two connections when the left and right (or start and end) sides are constrained.

public inthorizontalChainStyle

If the child is the start of a horizontal chain, this attribute will drive how the elements of the chain will be positioned.

public floathorizontalWeight

The child's weight that we can use to distribute the available horizontal space in a chain, if the dimension behaviour is set to MATCH_CONSTRAINT

public static final intLEFT

The left side of a view.

public intleftToLeft

Constrains the left side of a child to the left side of a target child (contains the target child id).

public intleftToRight

Constrains the left side of a child to the right side of a target child (contains the target child id).

public static final intMATCH_CONSTRAINT

Dimension will be controlled by constraints.

public static final intMATCH_CONSTRAINT_PERCENT

Set matchConstraintDefault* percent to be based on a percent of another dimension (by default, the parent) Use to set the matchConstraintDefaultWidth and matchConstraintDefaultHeight

public static final intMATCH_CONSTRAINT_SPREAD

Set matchConstraintDefault* spread as much as possible within its constraints.

public static final intMATCH_CONSTRAINT_WRAP

Set matchConstraintDefault* default to the wrap content size.

public intmatchConstraintDefaultHeight

Define how the widget vertical dimension is handled when set to MATCH_CONSTRAINT

public intmatchConstraintDefaultWidth

Define how the widget horizontal dimension is handled when set to MATCH_CONSTRAINT

public intmatchConstraintMaxHeight

Specify a maximum height size for the widget.

public intmatchConstraintMaxWidth

Specify a maximum width size for the widget.

public intmatchConstraintMinHeight

Specify a minimum height size for the widget.

public intmatchConstraintMinWidth

Specify a minimum width size for the widget.

public floatmatchConstraintPercentHeight

Specify the percentage when using the match constraint percent mode.

public floatmatchConstraintPercentWidth

Specify the percentage when using the match constraint percent mode.

public intorientation

public static final intPARENT_ID

References the id of the parent.

public static final intRIGHT

The right side of a view.

public intrightToLeft

Constrains the right side of a child to the left side of a target child (contains the target child id).

public intrightToRight

Constrains the right side of a child to the right side of a target child (contains the target child id).

public static final intSTART

The left side of a view in left to right languages.

public intstartToEnd

Constrains the start side of a child to the end side of a target child (contains the target child id).

public intstartToStart

Constrains the start side of a child to the start side of a target child (contains the target child id).

public static final intTOP

The top of a view.

public inttopToBottom

Constrains the top side of a child to the bottom side of a target child (contains the target child id).

public inttopToTop

Constrains the top side of a child to the top side of a target child (contains the target child id).

public static final intUNSET

Defines an id that is not set.

public static final intVERTICAL

The vertical orientation.

public floatverticalBias

The ratio between two connections when the top and bottom sides are constrained.

public intverticalChainStyle

If the child is the start of a vertical chain, this attribute will drive how the elements of the chain will be positioned.

public floatverticalWeight

The child's weight that we can use to distribute the available vertical space in a chain, if the dimension behaviour is set to MATCH_CONSTRAINT

public static final intWRAP_BEHAVIOR_HORIZONTAL_ONLY

public static final intWRAP_BEHAVIOR_INCLUDED

public static final intWRAP_BEHAVIOR_SKIPPED

public static final intWRAP_BEHAVIOR_VERTICAL_ONLY

public intwrapBehaviorInParent

Specify how this view is taken in account during the parent's wrap computation Can be either of: WRAP_BEHAVIOR_INCLUDED the widget is taken in account for the wrap (default) WRAP_BEHAVIOR_HORIZONTAL_ONLY the widget will be included in the wrap only horizontally WRAP_BEHAVIOR_VERTICAL_ONLY the widget will be included in the wrap only vertically WRAP_BEHAVIOR_SKIPPED the widget is not part of the wrap computation

Constructors
publicLayoutParams(ConstraintLayout.LayoutParams source)

Create a LayoutParams base on an existing layout Params

publicLayoutParams(Context c, AttributeSet attrs)

publicLayoutParams(ViewGroup.LayoutParams source)

Methods
public java.lang.StringgetConstraintTag()

Tag that can be used to identify a view as being a member of a group.

public ConstraintWidgetgetConstraintWidget()

public voidreset()

Reset the ConstraintWidget

public voidresolveLayoutDirection(int layoutDirection)

public voidsetWidgetDebugName(java.lang.String text)

public voidvalidate()

validate the layout

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Fields

public static final int MATCH_CONSTRAINT

Dimension will be controlled by constraints.

public static final int PARENT_ID

References the id of the parent.

public static final int UNSET

Defines an id that is not set.

public static final int GONE_UNSET

Defines an id that is not set.

public static final int HORIZONTAL

The horizontal orientation.

public static final int VERTICAL

The vertical orientation.

public static final int LEFT

The left side of a view.

public static final int RIGHT

The right side of a view.

public static final int TOP

The top of a view.

public static final int BOTTOM

The bottom side of a view.

public static final int BASELINE

The baseline of the text in a view.

public static final int START

The left side of a view in left to right languages. In right to left languages it corresponds to the right side of the view

public static final int END

The right side of a view in right to left languages. In right to left languages it corresponds to the left side of the view

public static final int CIRCLE

Circle reference from a view.

public static final int MATCH_CONSTRAINT_WRAP

Set matchConstraintDefault* default to the wrap content size. Use to set the matchConstraintDefaultWidth and matchConstraintDefaultHeight

public static final int MATCH_CONSTRAINT_SPREAD

Set matchConstraintDefault* spread as much as possible within its constraints. Use to set the matchConstraintDefaultWidth and matchConstraintDefaultHeight

public static final int MATCH_CONSTRAINT_PERCENT

Set matchConstraintDefault* percent to be based on a percent of another dimension (by default, the parent) Use to set the matchConstraintDefaultWidth and matchConstraintDefaultHeight

public static final int CHAIN_SPREAD

Chain spread style

public static final int CHAIN_SPREAD_INSIDE

Chain spread inside style

public static final int CHAIN_PACKED

Chain packed style

public int guideBegin

The distance of child (guideline) to the top or left edge of its parent.

public int guideEnd

The distance of child (guideline) to the bottom or right edge of its parent.

public float guidePercent

The ratio of the distance to the parent's sides

public boolean guidelineUseRtl

The ratio of the distance to the parent's sides

public int leftToLeft

Constrains the left side of a child to the left side of a target child (contains the target child id).

public int leftToRight

Constrains the left side of a child to the right side of a target child (contains the target child id).

public int rightToLeft

Constrains the right side of a child to the left side of a target child (contains the target child id).

public int rightToRight

Constrains the right side of a child to the right side of a target child (contains the target child id).

public int topToTop

Constrains the top side of a child to the top side of a target child (contains the target child id).

public int topToBottom

Constrains the top side of a child to the bottom side of a target child (contains the target child id).

public int bottomToTop

Constrains the bottom side of a child to the top side of a target child (contains the target child id).

public int bottomToBottom

Constrains the bottom side of a child to the bottom side of a target child (contains the target child id).

public int baselineToBaseline

Constrains the baseline of a child to the baseline of a target child (contains the target child id).

public int baselineToTop

Constrains the baseline of a child to the top of a target child (contains the target child id).

public int baselineToBottom

Constrains the baseline of a child to the bottom of a target child (contains the target child id).

public int circleConstraint

Constrains the center of a child to the center of a target child (contains the target child id).

public int circleRadius

The radius used for a circular constraint

public float circleAngle

The angle used for a circular constraint]

public int startToEnd

Constrains the start side of a child to the end side of a target child (contains the target child id).

public int startToStart

Constrains the start side of a child to the start side of a target child (contains the target child id).

public int endToStart

Constrains the end side of a child to the start side of a target child (contains the target child id).

public int endToEnd

Constrains the end side of a child to the end side of a target child (contains the target child id).

public int goneLeftMargin

The left margin to use when the target is gone.

public int goneTopMargin

The top margin to use when the target is gone.

public int goneRightMargin

The right margin to use when the target is gone

public int goneBottomMargin

The bottom margin to use when the target is gone.

public int goneStartMargin

The start margin to use when the target is gone.

public int goneEndMargin

The end margin to use when the target is gone.

public int goneBaselineMargin

The baseline margin to use when the target is gone.

public int baselineMargin

The baseline margin.

public float horizontalBias

The ratio between two connections when the left and right (or start and end) sides are constrained.

public float verticalBias

The ratio between two connections when the top and bottom sides are constrained.

public java.lang.String dimensionRatio

The ratio information.

public float horizontalWeight

The child's weight that we can use to distribute the available horizontal space in a chain, if the dimension behaviour is set to MATCH_CONSTRAINT

public float verticalWeight

The child's weight that we can use to distribute the available vertical space in a chain, if the dimension behaviour is set to MATCH_CONSTRAINT

public int horizontalChainStyle

If the child is the start of a horizontal chain, this attribute will drive how the elements of the chain will be positioned. The possible values are:

public int verticalChainStyle

If the child is the start of a vertical chain, this attribute will drive how the elements of the chain will be positioned. The possible values are:

public int matchConstraintDefaultWidth

Define how the widget horizontal dimension is handled when set to MATCH_CONSTRAINT

public int matchConstraintDefaultHeight

Define how the widget vertical dimension is handled when set to MATCH_CONSTRAINT

public int matchConstraintMinWidth

Specify a minimum width size for the widget. It will only apply if the size of the widget is set to MATCH_CONSTRAINT. Don't apply if the widget is part of a horizontal chain.

public int matchConstraintMinHeight

Specify a minimum height size for the widget. It will only apply if the size of the widget is set to MATCH_CONSTRAINT. Don't apply if the widget is part of a vertical chain.

public int matchConstraintMaxWidth

Specify a maximum width size for the widget. It will only apply if the size of the widget is set to MATCH_CONSTRAINT. Don't apply if the widget is part of a horizontal chain.

public int matchConstraintMaxHeight

Specify a maximum height size for the widget. It will only apply if the size of the widget is set to MATCH_CONSTRAINT. Don't apply if the widget is part of a vertical chain.

public float matchConstraintPercentWidth

Specify the percentage when using the match constraint percent mode. From 0 to 1.

public float matchConstraintPercentHeight

Specify the percentage when using the match constraint percent mode. From 0 to 1.

public int editorAbsoluteX

The design time location of the left side of the child. Used at design time for a horizontally unconstrained child.

public int editorAbsoluteY

The design time location of the right side of the child. Used at design time for a vertically unconstrained child.

public int orientation

public boolean constrainedWidth

Specify if the horizontal dimension is constrained in case both left & right constraints are set and the widget dimension is not a fixed dimension. By default, if a widget is set to WRAP_CONTENT, we will treat that dimension as a fixed dimension, meaning the dimension will not change regardless of constraints. Setting this attribute to true allows the dimension to change in order to respect constraints.

public boolean constrainedHeight

Specify if the vertical dimension is constrained in case both top & bottom constraints are set and the widget dimension is not a fixed dimension. By default, if a widget is set to WRAP_CONTENT, we will treat that dimension as a fixed dimension, meaning the dimension will not change regardless of constraints. Setting this attribute to true allows the dimension to change in order to respect constraints.

public java.lang.String constraintTag

Define a category of view to be used by helpers and motionLayout

public static final int WRAP_BEHAVIOR_INCLUDED

public static final int WRAP_BEHAVIOR_HORIZONTAL_ONLY

public static final int WRAP_BEHAVIOR_VERTICAL_ONLY

public static final int WRAP_BEHAVIOR_SKIPPED

public int wrapBehaviorInParent

Specify how this view is taken in account during the parent's wrap computation Can be either of: WRAP_BEHAVIOR_INCLUDED the widget is taken in account for the wrap (default) WRAP_BEHAVIOR_HORIZONTAL_ONLY the widget will be included in the wrap only horizontally WRAP_BEHAVIOR_VERTICAL_ONLY the widget will be included in the wrap only vertically WRAP_BEHAVIOR_SKIPPED the widget is not part of the wrap computation

public boolean helped

Constructors

public LayoutParams(ConstraintLayout.LayoutParams source)

Create a LayoutParams base on an existing layout Params

Parameters:

source: the Layout Params to be copied

public LayoutParams(Context c, AttributeSet attrs)

public LayoutParams(ViewGroup.LayoutParams source)

Methods

public ConstraintWidget getConstraintWidget()

public void setWidgetDebugName(java.lang.String text)

Parameters:

text:

public void reset()

Reset the ConstraintWidget

public void validate()

validate the layout

public void resolveLayoutDirection(int layoutDirection)

public java.lang.String getConstraintTag()

Tag that can be used to identify a view as being a member of a group. Which can be used for Helpers or in MotionLayout

Returns:

tag string or null if not defined