Google is committed to advancing racial equity for Black communities. See how.

DpConstraints

@Immutable data class DpConstraints
kotlin.Any
   ↳ androidx.ui.layout.DpConstraints

Similar to Constraints, but with constraint values expressed in Dp.

Summary

Public constructors
<init>(minWidth: Dp = 0.dp, maxWidth: Dp = Dp.Infinity, minHeight: Dp = 0.dp, maxHeight: Dp = Dp.Infinity)

Similar to Constraints, but with constraint values expressed in Dp.

Companion functions
DpConstraints
fixed(width: Dp, height: Dp)

Creates constraints tight in both dimensions.

DpConstraints
fixedHeight(height: Dp)

Creates constraints with tight height and loose width.

DpConstraints
fixedWidth(width: Dp)

Creates constraints with tight width and loose height.

Extension functions
From androidx.ui.layout
DpConstraints
DpConstraints.enforce(otherConstraints: DpConstraints)

Returns the result of coercing the current constraints in a different set of constraints.

DpConstraints
DpConstraints.offset(horizontal: Dp = 0.dp, vertical: Dp = 0.dp)

Returns the DpConstraints obtained by offsetting the current instance with the given values.

Properties
Dp

Dp

Dp

Dp

Extension properties
From androidx.ui.layout
Boolean

Whether or not the upper bound on the maximum height.

Boolean

Whether or not the upper bound on the maximum width.

Boolean

Whether there is exactly one height value that satisfies the constraints.

Boolean

Whether there is exactly one width value that satisfies the constraints.

Boolean

Whether the area of a component respecting these constraints will definitely be 0.

Boolean

Whether there is any size that satisfies the current constraints.

Public constructors

<init>

DpConstraints(
    minWidth: Dp = 0.dp,
    maxWidth: Dp = Dp.Infinity,
    minHeight: Dp = 0.dp,
    maxHeight: Dp = Dp.Infinity)

Similar to Constraints, but with constraint values expressed in Dp.

Properties

maxHeight

@Stable val maxHeight: Dp

maxWidth

@Stable val maxWidth: Dp

minHeight

@Stable val minHeight: Dp

minWidth

@Stable val minWidth: Dp

Companion functions

fixed

@Stable fun fixed(
    width: Dp,
    height: Dp
): DpConstraints

Creates constraints tight in both dimensions.

fixedHeight

@Stable fun fixedHeight(height: Dp): DpConstraints

Creates constraints with tight height and loose width.

fixedWidth

@Stable fun fixedWidth(width: Dp): DpConstraints

Creates constraints with tight width and loose height.