DpConstraints

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

Similar to Constraints, but with constraint values expressed in Dp. They are used in the APIs of certain layout models such as Container or ConstrainedBox, and will be translated to Constraints before being used by the core measuring and layout steps.

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
tightConstraints(width: Dp, height: Dp)

Creates constraints tight in both dimensions.

DpConstraints

Creates constraints with tight height and loose width.

DpConstraints

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

Returns a copy of the current instance with no max constraints.

DpConstraints

Returns a copy of the current instance with no min 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.

DpConstraints

Returns a copy of the current instance with the constraints tightened to their largest size.

DpConstraints

Returns a copy of the current instance with the constraints tightened to their smallest size.

DpConstraints
DpConstraints.withTight(width: Dp? = null, height: Dp? = null)

Returns a copy of the current instance, overriding the specified values to be tight.

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 there is exactly one size that satisfies the constraints.

Boolean

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

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. They are used in the APIs of certain layout models such as Container or ConstrainedBox, and will be translated to Constraints before being used by the core measuring and layout steps.

Properties

maxHeight

val maxHeight: Dp

maxWidth

val maxWidth: Dp

minHeight

val minHeight: Dp

minWidth

val minWidth: Dp

Companion functions

tightConstraints

fun tightConstraints(
    width: Dp,
    height: Dp
): DpConstraints

Creates constraints tight in both dimensions.

tightConstraintsForHeight

fun tightConstraintsForHeight(height: Dp): DpConstraints

Creates constraints with tight height and loose width.

tightConstraintsForWidth

fun tightConstraintsForWidth(width: Dp): DpConstraints

Creates constraints with tight width and loose height.