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

ScaleKt

public final class ScaleKt


Summary

Public methods

static final @NonNull Modifier
scale(@NonNull Modifier receiver, float scale)

Scale the contents of both the horizontal and vertical axis uniformly by the same scale factor.

static final @NonNull Modifier
scale(@NonNull Modifier receiver, float scaleX, float scaleY)

Scale the contents of the composable by the following scale factors along the horizontal and vertical axis respectively.

Public methods

scale

public static final @NonNull Modifier scale(@NonNull Modifier receiver, float scale)

Scale the contents of both the horizontal and vertical axis uniformly by the same scale factor.

Usage of this API renders this composable into a separate graphics layer

import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.size
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.scale
import androidx.compose.ui.unit.dp

Box(
    Modifier.scale(2f)
        .size(100.dp, 100.dp)
)
Parameters
float scale

Multiplier to scale content along the horizontal and vertical axis

See also
graphicsLayer

Example usage:

scale

public static final @NonNull Modifier scale(@NonNull Modifier receiver, float scaleX, float scaleY)

Scale the contents of the composable by the following scale factors along the horizontal and vertical axis respectively. Negative scale factors can be used to mirror content across the corresponding horizontal or vertical axis.

Example usage:

import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.size
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.scale
import androidx.compose.ui.unit.dp

Box(
    Modifier.scale(scaleX = 2f, scaleY = 3f)
        .size(100.dp, 100.dp)
)

Usage of this API renders this composable into a separate graphics layer

Parameters
float scaleX

Multiplier to scale content along the horizontal axis

float scaleY

Multiplier to scale content along the vertical axis

See also
graphicsLayer