<div class='type'>Class</div>


<a id='references'></a>

<div class='sourceset sourceset-common'>Common</div>


```kotlin
value class Dp(val value: Float) : Comparable<Dp>
```


Dimension value representing device-independent pixels (dp). Component APIs specify their
dimensions such as line thickness in DP with Dp objects. Hairline (1 pixel) thickness may be
specified with `Hairline`, a dimension that take up no space. Dp are normally defined using `dp`,
which can be applied to `Int`, `Double`, and `Float`.


Drawing and Layout are done in pixels. To retrieve the pixel size of a Dp, use `Density.toPx`:


## Functions



<h2 id="plus-other">plus</h2>

```kotlin
inline operator fun plus(other: Dp) = Dp(this.value + other.value)
```


Add two `Dp`s together.




<hr class="docs-overload-divider">


<h2 id="minus-other">minus</h2>

```kotlin
inline operator fun minus(other: Dp) = Dp(this.value - other.value)
```


Subtract a Dp from another one.




<hr class="docs-overload-divider">


<h2 id="unaryminus">unaryMinus</h2>

```kotlin
inline operator fun unaryMinus() = Dp(-value)
```


This is the same as multiplying the Dp by -1.0.




<hr class="docs-overload-divider">


<h2 id="div-other">div</h2>

```kotlin
inline operator fun div(other: Float): Dp
```


Divide a Dp by a scalar.




<hr class="docs-overload-divider">


<h2 id="div-other-2">div</h2>

```kotlin
inline operator fun div(other: Int): Dp
```



<hr class="docs-overload-divider">


<h2 id="div-other-3">div</h2>

```kotlin
inline operator fun div(other: Dp): Float
```


Divide by another Dp to get a scalar.




<hr class="docs-overload-divider">


<h2 id="times-other">times</h2>

```kotlin
inline operator fun times(other: Float): Dp
```


Multiply a Dp by a scalar.




<hr class="docs-overload-divider">


<h2 id="times-other-2">times</h2>

```kotlin
inline operator fun times(other: Int): Dp
```

## Companion Object

#### Properties

<div class='sourceset sourceset-common'>Common</div>


```kotlin
val Hairline = Dp(0f)
```


A dimension used to represent a hairline drawing element. Hairline elements take up no
space, but will draw a single pixel, independent of the device's resolution and density.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val Infinity = Dp(Float.POSITIVE_INFINITY)
```


Infinite dp dimension.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val Unspecified = Dp(Float.NaN)
```


Constant that means unspecified Dp. Instead of comparing a `Dp` value to this constant,
consider using `isSpecified` and `isUnspecified` instead.