Composables UI is out: our new component library for Compose Multiplatform ->
Function

createCreationDisplayInfo

Creates a RemoteCreationDisplayInfo instance from the provided Context.

createCreationDisplayInfo

Source set: Android
public fun createCreationDisplayInfo(
    context: Context,
    size: Size =
        Size(
            width = context.resources.displayMetrics.widthPixels.toFloat(),
            height = context.resources.displayMetrics.heightPixels.toFloat(),
        ),
    isInspectionMode: Boolean = false,
    densityBehavior: RemoteDensityBehavior = RemoteDensityBehavior.Legacy,
): RemoteCreationDisplayInfo

Creates a RemoteCreationDisplayInfo instance from the provided Context.

This function extracts the display metrics (width, height, and density) from the Context's resources.

Parameters

context The Context used to access display metrics.
size The size of the display.
isInspectionMode Whether the capture is happening in inspection mode (e.g. for a preview). Defaults to false.
densityBehavior The RemoteDensityBehavior to use. Defaults to RemoteDensityBehavior.Legacy.

Returns

A RemoteCreationDisplayInfo object containing the display metrics from the context.

Last updated: