Skip to content

Dimensions

Android dp extensions for View and Context. Particularly handy when using Views DSL.

Supported platforms: Android.

The dp and dip extensions functions for View and Context are exactly the same, use the naming you prefer. They convert a value in Android’s dp to pixels for use in code.

The overload taking an Int returns an Int, the one taking a Float returns a Float.

Examples

val minTapTargetSize = dip(48)
val circleDiameter = dp(48f)

Download

implementation("com.louiscad.splitties:splitties-dimensions:3.0.0-beta01")