Class

RemoteDensity

Represents the screen density and font scale factor used for unit conversions in a remote composition context.

Source set: Android
public class RemoteDensity(public val density: RemoteFloat, public val fontScale: RemoteFloat)

Represents the screen density and font scale factor used for unit conversions in a remote composition context. Similar to Compose Density.

Companion Object

Properties

Source set: Android
public val Host: RemoteDensity

A RemoteDensity instance that represents the host's screen density, with font scale derived from the host's system font size and density settings.

Methods

Source set: Android
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun from(
    creationDisplayInfo: RemoteCreationDisplayInfo,
    context: Context? = null,
): RemoteDensity

Creates a RemoteDensity instance from the provided RemoteCreationDisplayInfo and Context.

Parameters

creationDisplayInfo The display information containing the screen density.
context optional context to get font scale from local configuration, if not provided it would default to 1.

Returns

A RemoteDensity instance with the density from the display info and the local font scale.

Last updated: