Jetpack Compose Academy · Aula

Tamanho, Peso e Estilo da Fonte

Deixe o texto em negrito, itálico e no tamanho adequado.

Aula 2 de 413 etapas

Tamanho, Peso e Estilo da Fonte é uma aula grátis de Jetpack Compose Academy no CoddyKit. Esta é a aula 2 de 4. Você pode ler a aula completa abaixo gratuitamente — depois pratica ao vivo no navegador com um editor de código integrado e um tutor de IA 24/7. Faz parte do caminho de aprendizado de Jetpack Compose Academy, e seu progresso é sincronizado entre a web e o app CoddyKit. O curso de Jetpack Compose Academy inclui 4 aulas no total.

Partes desta aula ainda não foram traduzidas e aparecem em inglês.

Style Your Text

Plain words are fine, but real apps need emphasis. Text accepts simple arguments to control size, weight, and style without any XML.

Set the Size

Use fontSize to make text bigger or smaller. Sizes use the sp unit, which respects the user accessibility font settings.

Text("Big title", fontSize = 24.sp)

Why sp, Not dp

Text uses sp so it scales with the system font size. Layout uses dp, but words should grow when a user prefers larger text.

Make It Bold

Reach for fontWeight when you want emphasis. FontWeight.Bold is the everyday choice for titles and important labels.

Text("Headline", fontWeight = FontWeight.Bold)

Weights Are a Scale

Weight is more than bold or not. FontWeight ranges from Light to Black, so you can dial in exactly the emphasis a design asks for.

FontWeight.Light
FontWeight.Medium
FontWeight.Black

Add Italics

Slant your text with fontStyle. FontStyle.Italic is great for quotes, captions, or a subtle hint of personality.

Text("a note", fontStyle = FontStyle.Italic)

Mix Them Together

These arguments combine freely. One Text call can be large, bold, and italic at once, all in a single readable line of code. 🙂

Text("Wow", fontSize = 20.sp,
     fontWeight = FontWeight.Bold)

Change the Font Family

Swap the typeface with fontFamily. Built-ins like Serif and Monospace ship for free, and you can load custom fonts too.

Text("code", fontFamily = FontFamily.Monospace)

Letter Spacing

For airy, polished headings, nudge letterSpacing. A little extra space between characters can make uppercase titles feel premium.

Text("MENU", letterSpacing = 2.sp)

Lean on Theme Styles

Instead of setting each value, pass a ready-made style from MaterialTheme. It keeps every screen visually consistent.

Text("Title", style = MaterialTheme.typography.titleLarge)

Small Touches, Big Polish

Size, weight, and style are tiny arguments, but together they turn flat text into a clear hierarchy users instantly understand.

Quick Check

Which unit should you give to fontSize, and why?

Recap

You styled text with fontSize, fontWeight, fontStyle, and family. Use sp for sizing, and prefer theme typography for a consistent look. 🎨

Grátis para começar

Aprenda Kotlin com um tutor de IA — grátis

Escreva e execute código real no seu navegador, obtenha ajuda instantânea de um tutor de IA 24/7 e continue de onde parou na web ou no app.

Cursos
30
Aulas
120

Perguntas Frequentes

A aula “Tamanho, Peso e Estilo da Fonte” é grátis?

Sim — o texto completo de “Tamanho, Peso e Estilo da Fonte” é grátis para ler aqui na web. Para praticá-la interativamente (um editor de código integrado e um tutor de IA 24/7) e desbloquear o restante do curso de Jetpack Compose Academy, atualize para CoddyKit PRO. O curso de Jetpack Compose Academy inclui 4 aulas no total.

O que vou aprender em “Tamanho, Peso e Estilo da Fonte”?

Deixe o texto em negrito, itálico e no tamanho adequado. Você pratica Jetpack Compose Academy com código prático que executa diretamente no navegador, e um tutor de IA 24/7 responde suas dúvidas enquanto trabalha na aula.

Preciso ter experiência prévia para começar Jetpack Compose Academy?

Nenhuma experiência prévia é necessária. Jetpack Compose Academy no CoddyKit é estruturado para alunos iniciantes até avançados, então você pode começar aqui ou desde o início e aprender no seu ritmo. Esta é a aula 2 de 4.

Quanto tempo leva a aula “Tamanho, Peso e Estilo da Fonte”?

A maioria das aulas CoddyKit leva cerca de 5–10 minutos. Cada uma é compacta e interativa, então você faz progresso constante e retoma exatamente de onde parou entre web e app.

Posso escrever e executar código nesta aula de Jetpack Compose Academy?

Sim. Cada aula de Jetpack Compose Academy inclui um editor de código integrado, então você escreve e executa código real direto no navegador e recebe feedback de IA instantaneamente — nenhuma configuração local necessária.

Todas as aulas deste curso

  1. A Composable Text
  2. Tamanho, Peso e Estilo da Fonte
  3. Cor, Alinhamento e Transbordamento
  4. AnnotatedString: Texto Misto Formatado
← Voltar para Jetpack Compose Academy