ConstraintLayout.LayoutParams

public static class ConstraintLayout.LayoutParams
extends ViewGroup.MarginLayoutParams

java.lang.Object
   ↳ android.view.ViewGroup.LayoutParams
     ↳ android.view.ViewGroup.MarginLayoutParams
       ↳ android.support.constraint.ConstraintLayout.LayoutParams


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

Constants

int BASELINE

The baseline of the text in a view.

int BOTTOM

The bottom side of a view.

int END

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

int LEFT

The left side of a view.

int MATCH_CONSTRAINT

Dimension will be controlled by constraints.

int PARENT_ID

References the id of the parent.

int RIGHT

The right side of a view.

int START

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

int TOP

The top of a view.

int UNSET

Defines an id that is not set.

Inherited constants

Fields

public static final int CHAIN_PACKED

Chain packed style

public static final int CHAIN_SPREAD

Chain spread style

public static final int CHAIN_SPREAD_INSIDE

Chain spread inside style

public static final int HORIZONTAL

The horizontal orientation.

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 MATCH_CONSTRAINT_SPREAD

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

public static final int MATCH_CONSTRAINT_WRAP

Set matchConstraintDefault* default to the wrap content size.

public static final int VERTICAL

The vertical orientation.

public int baselineToBaseline

Constrains the baseline of a child to the baseline 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 bottomToTop

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

public float circleAngle

The angle used for a circular constraint]

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 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.

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.

public String dimensionRatio

The ratio information.

public int editorAbsoluteX

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

public int editorAbsoluteY

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

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 endToStart

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

public int goneBottomMargin

The bottom margin to use when the target is gone.

public int goneEndMargin

The end margin to use when the target is gone.

public int goneLeftMargin

The left margin to use when the target is gone.

public int goneRightMargin

The right margin to use when the target is gone

public int goneStartMargin

The start margin to use when the target is gone.

public int goneTopMargin

The top margin to use when the target is gone.

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 top or left edge of its parent.

public float guidePercent

The ratio of the distance to the parent's sides

public boolean helped

public float horizontalBias

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

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.

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 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 matchConstraintDefaultHeight

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

  • -- the default.

public int matchConstraintDefaultWidth

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

  • -- the default.

public int matchConstraintMaxHeight

Specify a maximum height size for the widget.

public int matchConstraintMaxWidth

Specify a maximum width size for the widget.

public int matchConstraintMinHeight

Specify a minimum height size for the widget.

public int matchConstraintMinWidth

Specify a minimum width size for the widget.

public float matchConstraintPercentHeight

Specify the percentage when using the match constraint percent mode.

public float matchConstraintPercentWidth

Specify the percentage when using the match constraint percent mode.

public int orientation

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 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 topToBottom

Constrains the top side of a child to the bottom 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 float verticalBias

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

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.

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

Inherited fields

Public constructors

ConstraintLayout.LayoutParams(ConstraintLayout.LayoutParams source)

Create a LayoutParams base on an existing layout Params

ConstraintLayout.LayoutParams(Context c, AttributeSet attrs)
ConstraintLayout.LayoutParams(int width, int height)
ConstraintLayout.LayoutParams(ViewGroup.LayoutParams source)

Public methods

void reset()
void resolveLayoutDirection(int layoutDirection)

void validate()

Inherited methods

Constants

BASELINE

int BASELINE

The baseline of the text in a view.

Constant Value: 5 (0x00000005)

BOTTOM

int BOTTOM

The bottom side of a view.

Constant Value: 4 (0x00000004)

END

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

Constant Value: 7 (0x00000007)

LEFT

int LEFT

The left side of a view.

Constant Value: 1 (0x00000001)

MATCH_CONSTRAINT

int MATCH_CONSTRAINT

Dimension will be controlled by constraints.

Constant Value: 0 (0x00000000)

PARENT_ID

int PARENT_ID

References the id of the parent.

Constant Value: 0 (0x00000000)

RIGHT

int RIGHT

The right side of a view.

Constant Value: 2 (0x00000002)

START

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

Constant Value: 6 (0x00000006)

TOP

int TOP

The top of a view.

Constant Value: 3 (0x00000003)

UNSET

int UNSET

Defines an id that is not set.

Constant Value: -1 (0xffffffff)

Fields

CHAIN_PACKED

int CHAIN_PACKED

Chain packed style

CHAIN_SPREAD

int CHAIN_SPREAD

Chain spread style

CHAIN_SPREAD_INSIDE

int CHAIN_SPREAD_INSIDE

Chain spread inside style

HORIZONTAL

int HORIZONTAL

The horizontal orientation.

MATCH_CONSTRAINT_PERCENT

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

MATCH_CONSTRAINT_SPREAD

int MATCH_CONSTRAINT_SPREAD

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

MATCH_CONSTRAINT_WRAP

int MATCH_CONSTRAINT_WRAP

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

VERTICAL

int VERTICAL

The vertical orientation.

baselineToBaseline

int baselineToBaseline

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

bottomToBottom

int bottomToBottom

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

bottomToTop

int bottomToTop

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

circleAngle

float circleAngle

The angle used for a circular constraint]

circleConstraint

int circleConstraint

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

circleRadius

int circleRadius

The radius used for a circular constraint

constrainedHeight

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.

constrainedWidth

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.

dimensionRatio

String dimensionRatio

The ratio information.

editorAbsoluteX

int editorAbsoluteX

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

editorAbsoluteY

int editorAbsoluteY

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

endToEnd

int endToEnd

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

endToStart

int endToStart

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

goneBottomMargin

int goneBottomMargin

The bottom margin to use when the target is gone.

goneEndMargin

int goneEndMargin

The end margin to use when the target is gone.

goneLeftMargin

int goneLeftMargin

The left margin to use when the target is gone.

goneRightMargin

int goneRightMargin

The right margin to use when the target is gone

goneStartMargin

int goneStartMargin

The start margin to use when the target is gone.

goneTopMargin

int goneTopMargin

The top margin to use when the target is gone.

guideBegin

int guideBegin

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

guideEnd

int guideEnd

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

guidePercent

float guidePercent

The ratio of the distance to the parent's sides

helped

boolean helped

horizontalBias

float horizontalBias

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

horizontalChainStyle

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:

  • -- the elements will be spread out
  • -- similar, but the endpoints of the chain will not be spread out
  • -- the elements of the chain will be packed together. The horizontal bias attribute of the child will then affect the positioning of the packed elements

horizontalWeight

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

leftToLeft

int leftToLeft

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

leftToRight

int leftToRight

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

matchConstraintDefaultHeight

int matchConstraintDefaultHeight

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

  • -- the default. The dimension will expand up to the constraints, minus margins
  • -- DEPRECATED -- use instead WRAP_CONTENT and constrainedHeight=true
    The dimension will be the same as WRAP_CONTENT, unless the size ends up too large for the constraints; in that case the dimension will expand up to the constraints, minus margins
  • This attribute may not be applied if the widget is part of a chain in that dimension.
  • -- The dimension will be a percent of another widget (by default, the parent)

matchConstraintDefaultWidth

int matchConstraintDefaultWidth

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

  • -- the default. The dimension will expand up to the constraints, minus margins
  • -- DEPRECATED -- use instead WRAP_CONTENT and constrainedWidth=true
    The dimension will be the same as WRAP_CONTENT, unless the size ends up too large for the constraints; in that case the dimension will expand up to the constraints, minus margins
  • This attribute may not be applied if the widget is part of a chain in that dimension.
  • -- The dimension will be a percent of another widget (by default, the parent)

matchConstraintMaxHeight

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 an vertical chain.

matchConstraintMaxWidth

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 an horizontal chain.

matchConstraintMinHeight

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 an vertical chain.

matchConstraintMinWidth

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 an horizontal chain.

matchConstraintPercentHeight

float matchConstraintPercentHeight

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

matchConstraintPercentWidth

float matchConstraintPercentWidth

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

orientation

int orientation

rightToLeft

int rightToLeft

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

rightToRight

int rightToRight

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

startToEnd

int startToEnd

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

startToStart

int startToStart

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

topToBottom

int topToBottom

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

topToTop

int topToTop

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

verticalBias

float verticalBias

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

verticalChainStyle

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:

  • -- the elements will be spread out
  • -- similar, but the endpoints of the chain will not be spread out
  • -- the elements of the chain will be packed together. The vertical bias attribute of the child will then affect the positioning of the packed elements

verticalWeight

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 constructors

ConstraintLayout.LayoutParams

ConstraintLayout.LayoutParams (ConstraintLayout.LayoutParams source)

Create a LayoutParams base on an existing layout Params

Parameters
source ConstraintLayout.LayoutParams: the Layout Params to be copied

ConstraintLayout.LayoutParams

ConstraintLayout.LayoutParams (Context c, 
                AttributeSet attrs)

Parameters
c Context

attrs AttributeSet

ConstraintLayout.LayoutParams

ConstraintLayout.LayoutParams (int width, 
                int height)

Parameters
width int

height int

ConstraintLayout.LayoutParams

ConstraintLayout.LayoutParams (ViewGroup.LayoutParams source)

Parameters
source ViewGroup.LayoutParams

Public methods

reset

void reset ()

resolveLayoutDirection

void resolveLayoutDirection (int layoutDirection)

Parameters
layoutDirection int

validate

void validate ()