<h2 id="constrain-otherconstraints">constrain</h2>

<div class='sourceset sourceset-android'>Android</div>

```kotlin
public fun VolumeConstraints.constrain(otherConstraints: VolumeConstraints): VolumeConstraints
```

Constrains the dimensions of this [VolumeConstraints](/jetpack-compose/androidx.xr.compose/compose/classes/VolumeConstraints) object to fit within the bounds of the
other [VolumeConstraints](/jetpack-compose/androidx.xr.compose/compose/classes/VolumeConstraints) object.

#### Parameters

| | |
| --- | --- |
| otherConstraints | the other [VolumeConstraints](/jetpack-compose/androidx.xr.compose/compose/classes/VolumeConstraints) to constrain against. |

#### Returns

| | |
| --- | --- |
|  | a new [VolumeConstraints](/jetpack-compose/androidx.xr.compose/compose/classes/VolumeConstraints) object with dimensions constrained within the bounds of `otherConstraints`. |