-
-
Save KatieBarnett/3613cca871faa02572d68d61732b97c0 to your computer and use it in GitHub Desktop.
Font scale multipreview
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Preview( | |
name = "small font", group = "Font scaling", fontScale = 0.85f, showBackground = true | |
) | |
@Preview( | |
name = "regular font", group = "Font scaling", fontScale = 1.0f, showBackground = true | |
) | |
@Preview( | |
name = "large font", group = "Font scaling", fontScale = 1.15f, showBackground = true | |
) | |
@Preview( | |
name = "extra large font", group = "Font scaling", fontScale = 1.3f, showBackground = true | |
) | |
annotation class FontScalePreviews | |
@FontScalePreviews | |
@Composable | |
fun NonResizingTextPreview() { | |
ExperimentsTheme { | |
Box(modifier = Modifier.width(200.dp)) { | |
Text(text = "This is resizing text with font scale ${LocalDensity.current.fontScale}") | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment