Jetpack Compose Academy · Lección

Tamaño, peso y estilo de fuente

Configure el texto en negrita o cursiva y con el tamaño adecuado.

Lección 2 de 413 pasos

Tamaño, peso y estilo de fuente es una lección gratuita de Jetpack Compose Academy en CoddyKit. Esta es la lección 2 de 4. Puedes leer la lección completa abajo gratuitamente — luego la practicas en el navegador con un editor de código integrado y un tutor de IA 24/7. Forma parte de la ruta de aprendizaje de Jetpack Compose Academy, y tu progreso se sincroniza en la web y la app de CoddyKit. El curso de Jetpack Compose Academy incluye 4 lecciones en total.

Partes de esta lección aún no han sido traducidas y se muestran en 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. 🎨

Gratis para empezar

Aprende Kotlin con un tutor de IA — gratis

Escribe y ejecuta código real en tu navegador, obtén ayuda instantánea de un tutor de IA disponible 24/7 y continúa donde lo dejaste en la web o en la aplicación.

Cursos
30
Lecciones
120

Preguntas frecuentes

¿La lección «Tamaño, peso y estilo de fuente» es gratis?

Sí — el texto completo de «Tamaño, peso y estilo de fuente» es gratis para leer aquí en la web. Para practicarla de forma interactiva (editor de código integrado y tutor de IA 24/7) y desbloquear el resto del curso de Jetpack Compose Academy, actualiza a CoddyKit PRO. El curso de Jetpack Compose Academy incluye 4 lecciones en total.

¿Qué aprenderé en «Tamaño, peso y estilo de fuente»?

Configure el texto en negrita o cursiva y con el tamaño adecuado. Practicas Jetpack Compose Academy con código real que ejecutas directamente en el navegador, y un tutor de IA 24/7 responde tus preguntas mientras trabajas en la lección.

¿Necesito experiencia previa para empezar Jetpack Compose Academy?

No se requiere experiencia previa. Jetpack Compose Academy en CoddyKit está estructurado para principiantes hasta estudiantes avanzados, así que puedes empezar aquí o desde el inicio y avanzar a tu ritmo. Esta es la lección 2 de 4.

¿Cuánto tiempo toma la lección «Tamaño, peso y estilo de fuente»?

La mayoría de las lecciones de CoddyKit toman alrededor de 5–10 minutos. Cada una es compacta e interactiva, así que avanzas constantemente y retomas exactamente por donde dejaste en la web y la app.

¿Puedo escribir y ejecutar código en esta lección de Jetpack Compose Academy?

Sí. Cada lección de Jetpack Compose Academy incluye un editor de código integrado, así que escribes y ejecutas código real directamente en tu navegador y obtienes retroalimentación instantánea de IA — sin configuración local necesaria.

Todas las lecciones de este curso

  1. El Composable Text
  2. Tamaño, peso y estilo de fuente
  3. Color, alineación y desbordamiento
  4. AnnotatedString: texto enriquecido combinado
← Volver a Jetpack Compose Academy