Your First Kotlin Android App: Polishing the App

Aug 22 2023 · Kotlin 1.8.20, Android 13, Android Studio Flamingo | 2022.2.1

Part 2: Style the App

12. Style Text

Episode complete

Play next episode

Next
About this episode
Leave a rating/review
See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 11. Understand Themes in Android Next episode: 13. Style Buttons

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Heads up... You've reached locked video content where the transcript will be shown as obfuscated text.

Its time to style the text in the Bullseye app. Material Design 3 provides us with different typography styles for common use cases. We can use them as they are, update them or create our own styles for text. Doing this is straightforward as you鈥檒l see in the demo section. Let鈥檚 get into it.

Text(
  value.toString(),
  style = MaterialTheme.typography.labelLarge
)
style = MaterialTheme.typography.labelLarge.copy(fontSize = 20.sp)
@Preview(showBackground = true)
@Composable
fun GamePromptPreview() {
  GamePrompt(targetValue = 50)
}
Text(
  stringResource(R.string.instruction_text),
  style = MaterialTheme.typography.titleMedium.copy(letterSpacing = 1.sp, fontWeight = FontWeight.Bold) // New Code
)
Text(
//      "$targetValue",
  text = targetValue.toString(),
//      fontSize = 32.sp,
//      fontWeight = FontWeight.Bold,
  modifier = modifier.padding(8.dp),
  style = MaterialTheme.typography.displayMedium.copy(fontWeight = FontWeight.Bold)
)