scale
Common
Modifier in Compose Ui
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.
Last updated:
Installation
dependencies {
implementation("androidx.compose.ui:ui:1.8.0-alpha04")
}
Overloads
@Stable
fun Modifier.scale(scaleX: Float, scaleY: Float)
Parameters
name | description |
---|---|
scaleX | Multiplier to scale content along the horizontal axis |
scaleY | Multiplier to scale content along the vertical axis |
@Stable
fun Modifier.scale(scale: Float)
Parameters
name | description |
---|---|
scale | Multiplier to scale content along the horizontal and vertical axis |
Code Examples
ScaleNonUniformSample
@Composable
fun ScaleNonUniformSample() {
Box(Modifier.scale(scaleX = 2f, scaleY = 3f).size(100.dp, 100.dp))
}
ScaleUniformSample
@Composable
fun ScaleUniformSample() {
Box(Modifier.scale(2f).size(100.dp, 100.dp))
}