{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

DensityKt

public final class DensityKt


Summary

Public methods

static final @NonNull Density
Density(float density, float fontScale)

A density of the screen.

Public methods

Density

public static final @NonNull Density Density(float density, float fontScale)

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

Parameters
float density

The logical density of the display. This is a scaling factor for the Dp unit.

float fontScale

Current user preference for the scaling factor for fonts.