coerceIn

Function

Common
inline fun Dp.coerceIn(minimumValue: Dp, maximumValue: Dp): Dp

Ensures that this value lies in the specified range minimumValue..maximumValue.

Returns

this value if it's in the range, or minimumValue if this value is less than minimumValue, or maximumValue if this value is greater than maximumValue.