Density

Function

Common
fun Density(density: Float, fontScale: Float = 1f): Density

A density of the screen. Used for convert Dp to pixels.

Parameters

densityThe logical density of the display. This is a scaling factor for the Dp unit.
fontScaleCurrent user preference for the scaling factor for fonts.
Android
fun Density(context: Context): Density

Creates a Density for this Context.

Parameters

contextdensity values will be extracted from this Context