Property

LocalDensity

Provides the Density to be used to transform between density-independent pixel units (DP) and pixel units or scale-independent pixel units (SP) and pixel units.

Source set: Common
public val LocalDensity: ProvidableCompositionLocal<Density> =
    computedDefaultOf("LocalDensity") { LocalOwner.currentValue.density }

Provides the Density to be used to transform between density-independent pixel units (DP) and pixel units or scale-independent pixel units (SP) and pixel units. This is typically used when a DP is provided and it must be converted in the body of Layout or DrawModifier.

Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: