WearPreviewFontScales

@Preview(device = "id:wearos_small_round", showSystemUi = true, backgroundColor = 4278190080, showBackground = true, group = "Fonts - Small", fontScale = 0.94)
@Preview(device = "id:wearos_small_round", showSystemUi = true, backgroundColor = 4278190080, showBackground = true, group = "Fonts - Normal", fontScale = 1.0)
@Preview(device = "id:wearos_small_round", showSystemUi = true, backgroundColor = 4278190080, showBackground = true, group = "Fonts - Medium", fontScale = 1.06)
@Preview(device = "id:wearos_small_round", showSystemUi = true, backgroundColor = 4278190080, showBackground = true, group = "Fonts - Large", fontScale = 1.12)
@Preview(device = "id:wearos_small_round", showSystemUi = true, backgroundColor = 4278190080, showBackground = true, group = "Fonts - Larger", fontScale = 1.18)
@Preview(device = "id:wearos_small_round", showSystemUi = true, backgroundColor = 4278190080, showBackground = true, group = "Fonts - Largest", fontScale = 1.24)
annotation WearPreviewFontScales


WearPreviewFontScales is a multi-preview annotation for the Wear devices of following font scales

  • Fonts - Small: 0.94f
  • Fonts - Normal: 1f
  • Fonts - Medium: 1.06f
  • Fonts - Large: 1.12f
  • Fonts - Larger: 1.18f
  • Fonts - Largest: 1.24f

Font scales represent the scaling factor for fonts, relative to the base density scaling. Please note, the above list is not exhaustive. It previews the composables on a small round Wear device.

import androidx.compose.ui.res.painterResource
import androidx.wear.compose.material.CardDefaults
import androidx.wear.compose.material.MaterialTheme
import androidx.wear.compose.material.Text
import androidx.wear.compose.material.TitleCard

TitleCard(
    onClick = { /* Do something */ },
    title = { Text("TitleCard With an ImageBackground") },
    backgroundPainter =
        CardDefaults.imageWithScrimBackgroundPainter(
            backgroundImagePainter = painterResource(id = R.drawable.backgroundimage)
        ),
    contentColor = MaterialTheme.colors.onSurface,
    titleColor = MaterialTheme.colors.onSurface,
) {
    Text("Text coloured to stand out on the image")
}

Summary

Public constructors

Public constructors

WearPreviewFontScales

WearPreviewFontScales()