Skip to content

Instantly share code, notes, and snippets.

@KatieBarnett
Last active July 11, 2023 10:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KatieBarnett/3613cca871faa02572d68d61732b97c0 to your computer and use it in GitHub Desktop.
Save KatieBarnett/3613cca871faa02572d68d61732b97c0 to your computer and use it in GitHub Desktop.
Font scale multipreview
@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