# ConstraintProperties

Artifact: [androidx.constraintlayout:constraintlayout](https://developer.android.com/jetpack/androidx/releases/constraintlayout) [View Source](https://cs.android.com/search?q=file:androidx/constraintlayout/widget/ConstraintProperties.java+class:androidx.constraintlayout.widget.ConstraintProperties) Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

*** ** * ** ***


```
public class ConstraintProperties
```

<br />

*** ** * ** ***

**Added in 2.0**

ConstraintProperties provides an easy to use api to update the layout params of `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintLayout` children

## Summary

| ### Constants |
|---|---|
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#BASELINE() = 5` The baseline of the text in a view. |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#BOTTOM() = 4` The bottom side of a view. |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#END() = 7` The right side of a view in left to right languages. |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#LEFT() = 1` The left side of a view. |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#MATCH_CONSTRAINT() = 0` Dimension will be controlled by constraints |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#MATCH_CONSTRAINT_SPREAD() = 0` Calculate the size of a view in 0 dp by reducing the constrains gaps as much as possible |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#MATCH_CONSTRAINT_WRAP() = 1` How to calculate the size of a view in 0 dp by using its wrap_content size |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#PARENT_ID() = 0` References the id of the parent. |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#RIGHT() = 2` The right side of a view. |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#START() = 6` The left side of a view in left to right languages. |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#TOP() = 3` The top of a view. |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#UNSET() = -1` Used to indicate a parameter is cleared or not set |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#WRAP_CONTENT() = -2` Dimension will set by the view's content |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#ConstraintProperties(android.view.View)(https://developer.android.com/reference/android/view/View.html view)` |

| ### Public methods |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#addToHorizontalChain(int,int)(int leftId, int rightId)` Adds the view to a horizontal chain. |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#addToHorizontalChainRTL(int,int)(int leftId, int rightId)` Adds the view to a horizontal chain using RTL attributes. |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#addToVerticalChain(int,int)(int topId, int bottomId)` Adds a view to a vertical chain. |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#alpha(float)(float alpha)` Adjust the alpha of a view. |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#apply()()` Should be called to apply the changes currently a no op in place for subclasses and future use |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#center(int,int,int,int,int,int,float)( int firstID, int firstSide, int firstMargin, int secondId, int secondSide, int secondMargin, float bias )` Center view between the other two widgets. |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#centerHorizontally(int)(int toView)` Centers the view horizontally relative to toView's position. |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#centerHorizontally(int,int,int,int,int,int,float)( int leftId, int leftSide, int leftMargin, int rightId, int rightSide, int rightMargin, float bias )` Centers the widget horizontally to the left and right side on another widgets sides. |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#centerHorizontallyRtl(int)(int toView)` Centers the view horizontally relative to toView's position. |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#centerHorizontallyRtl(int,int,int,int,int,int,float)( int startId, int startSide, int startMargin, int endId, int endSide, int endMargin, float bias )` Centers the widgets horizontally to the left and right side on another widgets sides. |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#centerVertically(int)(int toView)` Centers the view vertically relative to toView's position. |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#centerVertically(int,int,int,int,int,int,float)( int topId, int topSide, int topMargin, int bottomId, int bottomSide, int bottomMargin, float bias )` Centers the widgets Vertically to the top and bottom side on another widgets sides. |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#connect(int,int,int,int)(int startSide, int endID, int endSide, int margin)` Create a constraint between two widgets. |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#constrainDefaultHeight(int)(int height)` Sets how the height is calculated ether MATCH_CONSTRAINT_WRAP or MATCH_CONSTRAINT_SPREAD. |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#constrainDefaultWidth(int)(int width)` Sets how the width is calculated ether MATCH_CONSTRAINT_WRAP or MATCH_CONSTRAINT_SPREAD. |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#constrainHeight(int)(int height)` Sets the height of the view. |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#constrainMaxHeight(int)(int height)` Sets the maximum height of the view. |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#constrainMaxWidth(int)(int width)` Sets the maximum width of the view. |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#constrainMinHeight(int)(int height)` Sets the minimum height of the view. |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#constrainMinWidth(int)(int width)` Sets the minimum width of the view. |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#constrainWidth(int)(int width)` Sets the width of the view. |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#dimensionRatio(java.lang.String)(https://developer.android.com/reference/java/lang/String.html ratio)` Constrains the views aspect ratio. |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#elevation(float)(float elevation)` Set the elevation of a view. |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#goneMargin(int,int)(int anchor, int value)` Sets the gone margin. |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#horizontalBias(float)(float bias)` Adjust the horizontal bias of the view (used with views constrained on left and right). |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#horizontalChainStyle(int)(int chainStyle)` How the elements of the horizontal chain will be positioned. |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#horizontalWeight(float)(float weight)` 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 |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#margin(int,int)(int anchor, int value)` Sets the margin. |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#removeConstraints(int)(int anchor)` Remove a constraint from this view. |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#removeFromHorizontalChain()()` Removes a view from a vertical chain. |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#removeFromVerticalChain()()` Removes a view from a vertical chain. |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#rotation(float)(float rotation)` Adjust the post-layout rotation about the Z axis of a view. |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#rotationX(float)(float rotationX)` Adjust the post-layout rotation about the X axis of a view. |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#rotationY(float)(float rotationY)` Adjust the post-layout rotation about the Y axis of a view. |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#scaleX(float)(float scaleX)` Adjust the post-layout scale in X of a view. |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#scaleY(float)(float scaleY)` Adjust the post-layout scale in Y of a view. |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#transformPivot(float,float)(float transformPivotX, float transformPivotY)` Set X and Y location of the pivot point around which the view will rotate and scale. |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#transformPivotX(float)(float transformPivotX)` Set X location of the pivot point around which the view will rotate and scale. |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#transformPivotY(float)(float transformPivotY)` Set Y location of the pivot point around which the view will rotate and scale. |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#translation(float,float)(float translationX, float translationY)` Adjust the post-layout X and Y translation of a view. |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#translationX(float)(float translationX)` Adjust the post-layout X translation of a view. |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#translationY(float)(float translationY)` Adjust the post-layout Y translation of a view. |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#translationZ(float)(float translationZ)` Adjust the post-layout translation in Z of a view. |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#verticalBias(float)(float bias)` Adjust the vertical bias of the view (used with views constrained on left and right). |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#verticalChainStyle(int)(int chainStyle)` How the elements of the vertical chain will be positioned. in a chain, if the dimension behaviour is set to MATCH_CONSTRAINT |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#verticalWeight(float)(float weight)` 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 |
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties#visibility(int)(int visibility)` Adjust the visibility of a view. |

## Constants

### BASELINE

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int BASELINE = 5
```

The baseline of the text in a view.

### BOTTOM

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int BOTTOM = 4
```

The bottom side of a view.

### END

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int END = 7
```

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

### LEFT

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int LEFT = 1
```

The left side of a view.

### MATCH_CONSTRAINT

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int MATCH_CONSTRAINT = 0
```

Dimension will be controlled by constraints

### MATCH_CONSTRAINT_SPREAD

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int MATCH_CONSTRAINT_SPREAD = 0
```

Calculate the size of a view in 0 dp by reducing the constrains gaps as much as possible

### MATCH_CONSTRAINT_WRAP

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int MATCH_CONSTRAINT_WRAP = 1
```

How to calculate the size of a view in 0 dp by using its wrap_content size

### PARENT_ID

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int PARENT_ID = 0
```

References the id of the parent.

### RIGHT

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int RIGHT = 2
```

The right side of a view.

### START

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int START = 6
```

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

### TOP

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int TOP = 3
```

The top of a view.

### UNSET

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int UNSET = -1
```

Used to indicate a parameter is cleared or not set

### WRAP_CONTENT

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int WRAP_CONTENT = -2
```

Dimension will set by the view's content

## Public constructors

### ConstraintProperties

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties(View view)
```

## Public methods

### addToHorizontalChain

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties addToHorizontalChain(int leftId, int rightId)
```

Adds the view to a horizontal chain.

| Parameters |
|---|---|
| `int leftId` | id of the view in chain to the left |
| `int rightId` | id of the view in chain to the right |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### addToHorizontalChainRTL

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties addToHorizontalChainRTL(int leftId, int rightId)
```

Adds the view to a horizontal chain using RTL attributes.

| Parameters |
|---|---|
| `int leftId` | id of the view in chain to the left |
| `int rightId` | id of the view in chain to the right |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### addToVerticalChain

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties addToVerticalChain(int topId, int bottomId)
```

Adds a view to a vertical chain.

| Parameters |
|---|---|
| `int topId` | view above. |
| `int bottomId` | view below |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### alpha

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties alpha(float alpha)
```

Adjust the alpha of a view.

| Parameters |
|---|---|
| `float alpha` | the alpha |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### apply

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public void apply()
```

Should be called to apply the changes currently a no op in place for subclasses and future use

### center

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties center(
    int firstID,
    int firstSide,
    int firstMargin,
    int secondId,
    int secondSide,
    int secondMargin,
    float bias
)
```

Center view between the other two widgets.

| Parameters |
|---|---|
| `int firstID` | ID of the first widget to connect the left or top of the widget to |
| `int firstSide` | the side of the widget to connect to |
| `int firstMargin` | the connection margin |
| `int secondId` | the ID of the second widget to connect to right or top of the widget to |
| `int secondSide` | the side of the widget to connect to |
| `int secondMargin` | the connection margin |
| `float bias` | the ratio between two connections |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### centerHorizontally

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties centerHorizontally(int toView)
```

Centers the view horizontally relative to toView's position.

| Parameters |
|---|---|
| `int toView` | ID of view to center on (or in) |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### centerHorizontally

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties centerHorizontally(
    int leftId,
    int leftSide,
    int leftMargin,
    int rightId,
    int rightSide,
    int rightMargin,
    float bias
)
```

Centers the widget horizontally to the left and right side on another widgets sides.

| Parameters |
|---|---|
| `int leftId` | The Id of the widget on the left side |
| `int leftSide` | The side of the leftId widget to connect to |
| `int leftMargin` | The margin on the left side |
| `int rightId` | The Id of the widget on the right side |
| `int rightSide` | The side of the rightId widget to connect to |
| `int rightMargin` | The margin on the right side |
| `float bias` | The ratio of the space on the left vs. right sides 0.5 is centered (default) |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### centerHorizontallyRtl

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties centerHorizontallyRtl(int toView)
```

Centers the view horizontally relative to toView's position.

| Parameters |
|---|---|
| `int toView` | ID of view to center on (or in) |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### centerHorizontallyRtl

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties centerHorizontallyRtl(
    int startId,
    int startSide,
    int startMargin,
    int endId,
    int endSide,
    int endMargin,
    float bias
)
```

Centers the widgets horizontally to the left and right side on another widgets sides.

| Parameters |
|---|---|
| `int startId` | The Id of the widget on the start side (left in non rtl languages) |
| `int startSide` | The side of the startId widget to connect to |
| `int startMargin` | The margin on the start side |
| `int endId` | The Id of the widget on the start side (left in non rtl languages) |
| `int endSide` | The side of the endId widget to connect to |
| `int endMargin` | The margin on the end side |
| `float bias` | The ratio of the space on the start vs end side 0.5 is centered (default) |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### centerVertically

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties centerVertically(int toView)
```

Centers the view vertically relative to toView's position.

| Parameters |
|---|---|
| `int toView` | ID of view to center on (or in) |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### centerVertically

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties centerVertically(
    int topId,
    int topSide,
    int topMargin,
    int bottomId,
    int bottomSide,
    int bottomMargin,
    float bias
)
```

Centers the widgets Vertically to the top and bottom side on another widgets sides.

| Parameters |
|---|---|
| `int topId` | The Id of the widget on the top side |
| `int topSide` | The side of the leftId widget to connect to |
| `int topMargin` | The margin on the top side |
| `int bottomId` | The Id of the widget on the bottom side |
| `int bottomSide` | The side of the bottomId widget to connect to |
| `int bottomMargin` | The margin on the bottom side |
| `float bias` | The ratio of the space on the top vs. bottom sides 0.5 is centered (default) |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### connect

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties connect(int startSide, int endID, int endSide, int margin)
```

Create a constraint between two widgets.

| Parameters |
|---|---|
| `int startSide` | the side of the widget to constrain |
| `int endID` | the id of the widget to constrain to |
| `int endSide` | the side of widget to constrain to |
| `int margin` | the margin to constrain (margin must be positive) |

### constrainDefaultHeight

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties constrainDefaultHeight(int height)
```

Sets how the height is calculated ether MATCH_CONSTRAINT_WRAP or MATCH_CONSTRAINT_SPREAD. Default is spread.

| Parameters |
|---|---|
| `int height` | MATCH_CONSTRAINT_WRAP or MATCH_CONSTRAINT_SPREAD |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### constrainDefaultWidth

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties constrainDefaultWidth(int width)
```

Sets how the width is calculated ether MATCH_CONSTRAINT_WRAP or MATCH_CONSTRAINT_SPREAD. Default is spread.

| Parameters |
|---|---|
| `int width` | MATCH_CONSTRAINT_WRAP or MATCH_CONSTRAINT_SPREAD |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### constrainHeight

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties constrainHeight(int height)
```

Sets the height of the view.

| Parameters |
|---|---|
| `int height` | the height of the view |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### constrainMaxHeight

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties constrainMaxHeight(int height)
```

Sets the maximum height of the view. It is a dimension, It is only applicable if height is #MATCH_CONSTRAINT}.

| Parameters |
|---|---|
| `int height` | the maximum height of the view |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### constrainMaxWidth

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties constrainMaxWidth(int width)
```

Sets the maximum width of the view. It is a dimension, It is only applicable if height is #MATCH_CONSTRAINT}.

| Parameters |
|---|---|
| `int width` | the maximum width of the view |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### constrainMinHeight

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties constrainMinHeight(int height)
```

Sets the minimum height of the view. It is a dimension, It is only applicable if height is #MATCH_CONSTRAINT}.

| Parameters |
|---|---|
| `int height` | the minimum height of the view |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### constrainMinWidth

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties constrainMinWidth(int width)
```

Sets the minimum width of the view. It is a dimension, It is only applicable if height is #MATCH_CONSTRAINT}.

| Parameters |
|---|---|
| `int width` | the minimum width of the view |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### constrainWidth

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties constrainWidth(int width)
```

Sets the width of the view.

| Parameters |
|---|---|
| `int width` | the width of the view |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### dimensionRatio

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties dimensionRatio(String ratio)
```

Constrains the views aspect ratio. For Example a HD screen is 16 by 9 = 16/(float)9 = 1.777f.

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html ratio` | The ratio of the width to height (width / height) |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### elevation

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties elevation(float elevation)
```

Set the elevation of a view.

| Parameters |
|---|---|
| `float elevation` | the elevation |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### goneMargin

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties goneMargin(int anchor, int value)
```

Sets the gone margin.

| Parameters |
|---|---|
| `int anchor` | The side to adjust the margin on |
| `int value` | The new value for the margin |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### horizontalBias

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties horizontalBias(float bias)
```

Adjust the horizontal bias of the view (used with views constrained on left and right).

| Parameters |
|---|---|
| `float bias` | the new bias 0.5 is in the middle |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### horizontalChainStyle

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties horizontalChainStyle(int chainStyle)
```

How the elements of the horizontal chain will be positioned. If the dimension behaviour is set to MATCH_CONSTRAINT. The possible values are:

- CHAIN_SPREAD -- the elements will be spread out
- CHAIN_SPREAD_INSIDE -- similar, but the endpoints of the chain will not be spread out
- CHAIN_PACKED -- 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

| Parameters |
|---|---|
| `int chainStyle` | the weight that we can use to distribute the horizontal space |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### horizontalWeight

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties horizontalWeight(float weight)
```

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

| Parameters |
|---|---|
| `float weight` | the weight that we can use to distribute the horizontal space |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### margin

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties margin(int anchor, int value)
```

Sets the margin.

| Parameters |
|---|---|
| `int anchor` | The side to adjust the margin on |
| `int value` | The new value for the margin |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### removeConstraints

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties removeConstraints(int anchor)
```

Remove a constraint from this view.

| Parameters |
|---|---|
| `int anchor` | the Anchor to remove constraint from |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### removeFromHorizontalChain

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties removeFromHorizontalChain()
```

Removes a view from a vertical chain. This assumes the view is connected to a vertical chain. Its behaviour is undefined if not part of a vertical chain.

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### removeFromVerticalChain

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties removeFromVerticalChain()
```

Removes a view from a vertical chain. This assumes the view is connected to a vertical chain. Its behaviour is undefined if not part of a vertical chain.

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### rotation

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties rotation(float rotation)
```

Adjust the post-layout rotation about the Z axis of a view.

| Parameters |
|---|---|
| `float rotation` | the rotation about the Z axis |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### rotationX

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties rotationX(float rotationX)
```

Adjust the post-layout rotation about the X axis of a view.

| Parameters |
|---|---|
| `float rotationX` | the rotation about the X axis |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### rotationY

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties rotationY(float rotationY)
```

Adjust the post-layout rotation about the Y axis of a view.

| Parameters |
|---|---|
| `float rotationY` | the rotation about the Y axis |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### scaleX

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties scaleX(float scaleX)
```

Adjust the post-layout scale in X of a view.

| Parameters |
|---|---|
| `float scaleX` | the scale in X |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### scaleY

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties scaleY(float scaleY)
```

Adjust the post-layout scale in Y of a view.

| Parameters |
|---|---|
| `float scaleY` | the scale in Y |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### transformPivot

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties transformPivot(float transformPivotX, float transformPivotY)
```

Set X and Y location of the pivot point around which the view will rotate and scale.

| Parameters |
|---|---|
| `float transformPivotX` | X location of the pivot point. |
| `float transformPivotY` | Y location of the pivot point. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### transformPivotX

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties transformPivotX(float transformPivotX)
```

Set X location of the pivot point around which the view will rotate and scale.

| Parameters |
|---|---|
| `float transformPivotX` | X location of the pivot point. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### transformPivotY

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties transformPivotY(float transformPivotY)
```

Set Y location of the pivot point around which the view will rotate and scale.

| Parameters |
|---|---|
| `float transformPivotY` | Y location of the pivot point. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### translation

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties translation(float translationX, float translationY)
```

Adjust the post-layout X and Y translation of a view.

| Parameters |
|---|---|
| `float translationX` | the translation in X |
| `float translationY` | the translation in Y |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### translationX

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties translationX(float translationX)
```

Adjust the post-layout X translation of a view.

| Parameters |
|---|---|
| `float translationX` | the translation in X |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### translationY

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties translationY(float translationY)
```

Adjust the post-layout Y translation of a view.

| Parameters |
|---|---|
| `float translationY` | the translation in Y |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### translationZ

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties translationZ(float translationZ)
```

Adjust the post-layout translation in Z of a view. This is the preferred way to adjust the shadow.

| Parameters |
|---|---|
| `float translationZ` | the translationZ |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### verticalBias

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties verticalBias(float bias)
```

Adjust the vertical bias of the view (used with views constrained on left and right).

| Parameters |
|---|---|
| `float bias` | the new bias 0.5 is in the middle |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### verticalChainStyle

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties verticalChainStyle(int chainStyle)
```

How the elements of the vertical chain will be positioned. in a chain, if the dimension behaviour is set to MATCH_CONSTRAINT

- CHAIN_SPREAD -- the elements will be spread out
- CHAIN_SPREAD_INSIDE -- similar, but the endpoints of the chain will not be spread out
- CHAIN_PACKED -- 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

| Parameters |
|---|---|
| `int chainStyle` | the weight that we can use to distribute the horizontal space |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### verticalWeight

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties verticalWeight(float weight)
```

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

| Parameters |
|---|---|
| `float weight` | the weight that we can use to distribute the vertical space |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |

### visibility

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public ConstraintProperties visibility(int visibility)
```

Adjust the visibility of a view.

| Parameters |
|---|---|
| `int visibility` | the visibility (View.VISIBLE, View.INVISIBLE, View.GONE) |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/widget/ConstraintProperties` | this |