Android 12 Developer Preview is here! Try it out, and give us your feedback!

DpOffset

@Immutable inline class DpOffset
kotlin.Any
   ↳ androidx.compose.ui.unit.DpOffset

A two-dimensional offset using Dp for units

Summary

Public methods
DpOffset
copy(x: Dp = this.x, y: Dp = this.y)

Returns a copy of this DpOffset instance optionally overriding the x or y parameter

operator DpOffset
minus(other: DpOffset)

Subtract a DpOffset from another one.

operator DpOffset
plus(other: DpOffset)

Add a DpOffset to another one.

String

Properties
Dp

The horizontal aspect of the offset in Dp

Dp

The vertical aspect of the offset in Dp

Companion properties
DpOffset

A DpOffset with 0 DP x and 0 DP y values.

Public methods

copy

fun copy(
    x: Dp = this.x,
    y: Dp = this.y
): DpOffset

Returns a copy of this DpOffset instance optionally overriding the x or y parameter

minus

@Stable inline operator fun minus(other: DpOffset): DpOffset

Subtract a DpOffset from another one.

plus

@Stable inline operator fun plus(other: DpOffset): DpOffset

Add a DpOffset to another one.

toString

@Stable fun toString(): String

Properties

x

@Stable val x: Dp

The horizontal aspect of the offset in Dp

y

@Stable val y: Dp

The vertical aspect of the offset in Dp

Companion properties

Zero

val Zero: DpOffset

A DpOffset with 0 DP x and 0 DP y values.