The Developer Preview for Android 11 is now available; test it out and share your feedback.

PxSquared

@Immutable inline class PxSquared : Comparable<PxSquared>
 kotlin.Any ↳ androidx.ui.core.PxSquared

Holds a unit of squared dimensions, such as 1.value * 2.px. PxSquared, PxCubed, and PxInverse are used primarily for Px calculations to ensure resulting units are as expected. Many times, Px calculations use scalars to determine the final dimension during calculation: val width = oldWidth * stretchAmount Other times, it is useful to do intermediate calculations with Dimensions directly: val width = oldWidth * newTotalWidth / oldTotalWidth

Summary

Public constructors

<init>(value: Float)

Holds a unit of squared dimensions, such as 1.value * 2.px.

Public methods

operator Int

Support comparing PxSquared with comparison operators.

operator PxSquared
div(other: Float)

Divide a DimensionSquare by a scalar.

operator Px
div(other: Px)

Divide by a Px to get a Px result.

operator Float
div(other: PxSquared)

Divide by a PxSquared to get a scalar result.

operator PxInverse
div(other: PxCubed)

Divide by a PxCubed to get a PxInverse result.

operator PxSquared
minus(other: PxSquared)

Subtract a DimensionSquare from another one.

operator PxSquared
plus(other: PxSquared)

operator PxSquared
times(other: Float)

Multiply by a scalar to get a PxSquared result.

operator PxCubed
times(other: Px)

Multiply by a scalar to get a PxSquared result.

String

Float

Public constructors

<init>

PxSquared(value: Float)

Holds a unit of squared dimensions, such as 1.value * 2.px. PxSquared, PxCubed, and PxInverse are used primarily for Px calculations to ensure resulting units are as expected. Many times, Px calculations use scalars to determine the final dimension during calculation: val width = oldWidth * stretchAmount Other times, it is useful to do intermediate calculations with Dimensions directly: val width = oldWidth * newTotalWidth / oldTotalWidth

Public methods

compareTo

inline operator fun compareTo(other: PxSquared): Int

Support comparing PxSquared with comparison operators.

div

inline operator fun div(other: Float): PxSquared

Divide a DimensionSquare by a scalar.

div

inline operator fun div(other: Px): Px

Divide by a Px to get a Px result.

div

inline operator fun div(other: PxSquared): Float

Divide by a PxSquared to get a scalar result.

div

inline operator fun div(other: PxCubed): PxInverse

Divide by a PxCubed to get a PxInverse result.

minus

inline operator fun minus(other: PxSquared): PxSquared

Subtract a DimensionSquare from another one.

plus

inline operator fun plus(other: PxSquared): PxSquared

times

inline operator fun times(other: Float): PxSquared

Multiply by a scalar to get a PxSquared result.

times

inline operator fun times(other: Px): PxCubed

Multiply by a scalar to get a PxSquared result.

toString

fun toString(): String

val value: Float