0Pricing
Jetpack Compose Academy · Leçon

Section avatar, nom et biographie

Assemblez l’en-tête avec une image et du texte.

Section avatar, nom et biographie est une leçon Jetpack Compose Academy gratuite sur CoddyKit. Ceci est la leçon 2 sur 4. Tu peux lire la leçon complète ci-dessous gratuitement — puis la pratiquer en direct dans le navigateur avec un éditeur de code intégré et un tuteur IA 24/7. Elle fait partie du parcours d'apprentissage Jetpack Compose Academy, et ta progression se synchronise sur le web et l'application CoddyKit. Le cours Jetpack Compose Academy comprend 4 leçons au total.

Certaines parties de cette leçon n'ont pas encore été traduites et s'affichent en anglais.

Build the Header First

Time to make the sketch real. You will start at the top of the card with the header: the avatar, the name, and a short bio. 👤

The Avatar Image

The avatar is an Image Composable that draws a drawable resource. Give it a clear size so it never balloons to fill the screen.

Image(
    painter = painterResource(R.drawable.avatar),
    contentDescription = "Profile photo"
)

Make It a Circle

Profile photos look best as circles. Chain clip with CircleShape on the Image modifier to round it into a perfect avatar.

Image(
    painter = painterResource(R.drawable.avatar),
    contentDescription = "Profile photo",
    modifier = Modifier.size(96.dp).clip(CircleShape)
)

Add the Name

Below the avatar comes the display name. A simple Text Composable shows the string the user will read first.

Text(text = "Ada Lovelace")

Style the Name

Names should stand out. Pass a style from MaterialTheme typography so the name looks like a proper heading.

Text(
    text = "Ada Lovelace",
    style = MaterialTheme.typography.titleLarge
)

The Bio Text

Under the name, add a one-line bio with another Text. Use a smaller, softer style so it reads as a subtitle, not a headline.

Text(
    text = "Building delightful apps.",
    style = MaterialTheme.typography.bodyMedium
)

Stack Them in a Column

Avatar, name, and bio stack vertically, so wrap all three in a Column. The order you write them is the order they appear.

Column {
    Image(/* avatar */)
    Text("Ada Lovelace")
    Text("Building delightful apps.")
}

Center Everything

Headers feel balanced when centered. Set horizontalAlignment to CenterHorizontally on the Column to line up the avatar and text.

Column(
    horizontalAlignment = Alignment.CenterHorizontally
) { /* ... */ }

Add Vertical Spacing

Cramped headers look messy. Use Arrangement.spacedBy on the Column to drop a consistent gap between the avatar, name, and bio.

Column(
    verticalArrangement = Arrangement.spacedBy(8.dp)
) { /* ... */ }

Pad the Header

Give the whole section room to breathe by adding padding to the Column modifier. Edges should never touch the screen frame.

Column(
    modifier = Modifier.padding(16.dp)
) { /* ... */ }

Header Section Done

You now have a clean header: a circular avatar, a bold name, and a soft bio, centered and spaced. The top of your card is finished. 🎉

Quick Check

How do you turn a square photo into a round avatar?

Recap: The Header

You built the header inside a centered Column: a clipped circular avatar, a styled name, and a subtle bio, all padded and spaced. Next you will add the stats row.

Questions Fréquemment Posées

La leçon « Section avatar, nom et biographie » est-elle gratuite ?

Oui — le texte complet de « Section avatar, nom et biographie » est gratuit à lire ici sur le web. Pour la pratiquer de manière interactive (un éditeur de code intégré et un tuteur IA 24/7) et déverrouiller le reste du cours Jetpack Compose Academy, passe à CoddyKit PRO. Le cours Jetpack Compose Academy comprend 4 leçons au total.

Qu'est-ce que j'apprendrai dans « Section avatar, nom et biographie » ?

Assemblez l’en-tête avec une image et du texte. Tu pratiques Jetpack Compose Academy avec du code pratique que tu exécutes directement dans le navigateur, et un tuteur IA 24/7 répond à tes questions au fur et à mesure que tu avances dans la leçon.

Dois-je avoir de l'expérience pour commencer Jetpack Compose Academy ?

Aucune expérience préalable n'est requise. Jetpack Compose Academy sur CoddyKit est structuré pour les débutants jusqu'aux apprenants avancés, donc tu peux commencer ici ou depuis le début et avancer à ton rythme. Ceci est la leçon 2 sur 4.

Combien de temps prend la leçon « Section avatar, nom et biographie » ?

La plupart des leçons CoddyKit prennent environ 5–10 minutes. Chacune est courte et interactive, tu progresses régulièrement et tu repiques exactement où tu t'es arrêté sur le web et l'app.

Peux-tu écrire et exécuter du code dans cette leçon Jetpack Compose Academy ?

Oui. Chaque leçon Jetpack Compose Academy inclut un éditeur de code intégré, tu écris et exécutes du vrai code directement dans ton navigateur et tu reçois des retours IA instantanés — aucune configuration locale requise.

Toutes les leçons de ce cours

  1. Esquisser la disposition d’une carte de profil
  2. Section avatar, nom et biographie
  3. Ligne de statistiques et bouton Suivre
  4. Extraire des Composables réutilisables
← Retour à Jetpack Compose Academy