Class

Typography

Class holding typography definitions as defined by the Wear Material typography specification.

FixedFontSize

@Sampled
@Composable
fun FixedFontSize() {
    val typography =
        MaterialTheme.typography.copy(
            display1 =
                MaterialTheme.typography.display1.copy(
                    fontSize = with(LocalDensity.current) { 40.dp.toSp() }
                )
        )
    MaterialTheme(typography = typography) {
        Text(
            text = "Fixed Font",
            maxLines = 1,
            style = MaterialTheme.typography.display1,
            color = MaterialTheme.colors.onBackground,
        )
    }
}
Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: