0Pricing
Android Academy · Lesson

Styling Text

Fonts, size, weight, and color.

Why Style Text?

In Jetpack Compose, the Text composable shows words on screen. By default it uses a plain look, but you can change its size, color, and weight.

Styling helps users read your app. A title should look bigger and bolder than body text.

You style Text by passing extra parameters to it.

Text("Hello Compose")

Making Text Bigger

The fontSize parameter controls how large the text is. Sizes use the sp unit, which scales with the user's font settings.

To use sp, add .sp after a number, like 24.sp.

Text(
    text = "Big Title",
    fontSize = 24.sp
)

All lessons in this course

  1. Styling Text
  2. Buttons and Clicks
  3. Spacing with Padding
  4. Colors and MaterialTheme
← Back to Android Academy