Dimension
interface Dimension
Dimension.Coercible |
A |
Dimension.MaxCoercible |
A |
Dimension.MinCoercible |
A |
Represents a dimension that can be assigned to the width or height of a childConstrainedLayoutReference.
Summary
Nested types |
|---|
interface Dimension.Coercible : DimensionA |
interface Dimension.MaxCoercible : DimensionA |
interface Dimension.MinCoercible : DimensionA |
Public companion functions |
|
|---|---|
Dimension |
A |
Dimension.MinCoercible |
preferredValue(dp: Dp)Links should be specified from both sides corresponding to this dimension, in order for this to work. |
Dimension |
Sets the dimensions to be defined as a ratio of the width and height. |
Dimension |
Creates a |
Public companion properties |
|
|---|---|
Dimension.Coercible |
Links should be specified from both sides corresponding to this dimension, in order for this to work. |
Dimension |
A fixed |
Dimension.Coercible |
Links should be specified from both sides corresponding to this dimension, in order for this to work. |
Dimension |
A fixed |
Public companion functions
percent
fun percent(percent: Float): Dimension
A Dimension that is a percent of the parent in the corresponding direction.
Where 1f is 100% and 0f is 0%.
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 companion properties
fillToConstraints
val fillToConstraints: Dimension.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 matchParent: Dimension
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 preferredWrapContent: Dimension.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 wrapContent: Dimension
A fixed Dimension with wrap content behavior. The size will not change according to the constraints in the ConstraintSet.