# ConstraintsChangedListener

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

*** ** * ** ***


```
abstract class ConstraintsChangedListener
```

<br />

*** ** * ** ***

**Added in 2.0**

Callbacks on state change

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintsChangedListener#ConstraintsChangedListener()()` |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintsChangedListener#postLayoutChange(int,int)(stateId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, constraintId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` called after layout happens |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintsChangedListener#preLayoutChange(int,int)(stateId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, constraintId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` called before layout happens |

## Public constructors

### ConstraintsChangedListener

Added in 2.2.2

```
ConstraintsChangedListener()
```

## Public functions

### postLayoutChange

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

```
fun postLayoutChange(stateId: Int, constraintId: Int): Unit
```

called after layout happens

| Parameters |
|---|---|
| `stateId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | -1 if state unknown, otherwise the current state |
| `constraintId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the current constraintSet id we transitioned to |

### preLayoutChange

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

```
fun preLayoutChange(stateId: Int, constraintId: Int): Unit
```

called before layout happens

| Parameters |
|---|---|
| `stateId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | -1 if state unknown, otherwise the state we will transition to |
| `constraintId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the constraintSet id that we will transition to |