Dimension.Companion


object Dimension.Companion


Summary

Public functions

Dimension
percent(percent: Float)

A Dimension that is a percent of the parent in the corresponding direction.

Dimension.MinCoercible

Links should be specified from both sides corresponding to this dimension, in order for this to work.

Dimension
ratio(ratio: String)

Sets the dimensions to be defined as a ratio of the width and height.

Dimension
value(dp: Dp)

Creates a Dimension representing a fixed dp size.

Public properties

Dimension.Coercible

Links should be specified from both sides corresponding to this dimension, in order for this to work.

Dimension

A fixed Dimension that matches the dimensions of the root ConstraintLayout.

Dimension.Coercible

Links should be specified from both sides corresponding to this dimension, in order for this to work.

Dimension

A fixed Dimension with wrap content behavior.

Public functions

percent

fun percent(percent: Float): Dimension

A Dimension that is a percent of the parent in the corresponding direction.

preferredValue

fun preferredValue(dp: Dp): Dimension.MinCoercible

Links should be specified from both sides corresponding to this dimension, in order for this to work.

Creates a Dimension such that if the constraints allow it, will have the size given by dp, otherwise will take the size remaining within the constraints.

This is effectively a shorthand for fillToConstraints with a max value.

To make the value fixed (respected regardless the ConstraintSet), value should be used instead.

ratio

fun ratio(ratio: String): Dimension

Sets the dimensions to be defined as a ratio of the width and height. The assigned dimension will be considered to also be fillToConstraints.

The string to define a ratio is defined by the format: 'W:H'. Where H is the height as a proportion of W (the width).

Eg: width = Dimension.ratio('1:2') sets the width to be half as large as the height.

Note that only one dimension should be defined as a ratio.

value

fun value(dp: Dp): Dimension

Creates a Dimension representing a fixed dp size. The size will not change according to the constraints in the ConstraintSet.

Public properties

fillToConstraints

val fillToConstraintsDimension.Coercible

Links should be specified from both sides corresponding to this dimension, in order for this to work.

A Dimension that spreads to match constraints.

matchParent

val matchParentDimension

A fixed Dimension that matches the dimensions of the root ConstraintLayout. The size will not change accoring to the constraints in the ConstraintSet.

preferredWrapContent

val preferredWrapContentDimension.Coercible

Links should be specified from both sides corresponding to this dimension, in order for this to work.

A Dimension with suggested wrap content behavior. The wrap content size will be respected unless the constraints in the ConstraintSet do not allow it. To make the value fixed (respected regardless the ConstraintSet), wrapContent should be used instead.

wrapContent

val wrapContentDimension

A fixed Dimension with wrap content behavior. The size will not change according to the constraints in the ConstraintSet.