Dimensions

data class Dimensions(val startDp: Float = 0.0f, val topDp: Float = 0.0f, val endDp: Float = 0.0f, val bottomDp: Float = 0.0f)

Defines the size of each edge of a rectangle. Used to store measurements such as padding or margin values.

Parameters

startDp

the value for the start edge in the dp unit.

topDp

the value for the top edge in the dp unit.

endDp

the value for the end edge in the dp unit.

bottomDp

the value for the bottom edge in the dp unit.

Constructors

Link copied to clipboard
constructor(horizontalDp: Float = 0.0f, verticalDp: Float = 0.0f)

Creates a Dimensions instance using the provided measurements.

constructor(allDp: Float = 0.0f)

Creates a Dimensions instance using the provided measurements.

constructor(startDp: Float = 0.0f, topDp: Float = 0.0f, endDp: Float = 0.0f, bottomDp: Float = 0.0f)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val bottomDp: Float = 0.0f
Link copied to clipboard
val endDp: Float = 0.0f
Link copied to clipboard

The sum of startDp and endDp.

Link copied to clipboard
val startDp: Float = 0.0f
Link copied to clipboard
val topDp: Float = 0.0f
Link copied to clipboard

The sum of topDp and bottomDp.

Functions

Link copied to clipboard
fun getLeftDp(isLtr: Boolean): Float

Returns the dimension of the left edge depending on the layout orientation.

Link copied to clipboard
fun getRightDp(isLtr: Boolean): Float

Returns the dimension of the right edge depending on the layout orientation.