0Pricing
Jetpack Compose Academy · Lezione

Cosa sostituisce Compose: addio XML

Scopra perché l'interfaccia dichiarativa è migliore dell'inflazione imperativa delle View.

Cosa sostituisce Compose: addio XML è una lezione Jetpack Compose Academy gratuita su CoddyKit. Questa è la lezione 1 di 4. Puoi leggere la lezione completa qui gratuitamente — poi esercitati direttamente nel browser con un editor di codice integrato e un tutor IA disponibile 24/7. Fa parte del percorso di apprendimento Jetpack Compose Academy, e i tuoi progressi si sincronizzano tra il web e l'app CoddyKit. Il corso Jetpack Compose Academy include 4 lezioni in totale.

Parti di questa lezione non sono ancora state tradotte e vengono mostrate in inglese.

Meet Jetpack Compose

Jetpack Compose is Android's modern toolkit for building UI in pure Kotlin. No more XML layout files. You describe screens with simple functions. 🎉

The Old Way: XML Layouts

For years, Android UI lived in XML files. You wrote markup describing views, then inflated and wired them up in Kotlin code separately.

<LinearLayout android:orientation="vertical">
    <TextView android:text="Hello" />
</LinearLayout>

Two Files, One Screen

The painful part was the split: layout lived in XML, behavior in Kotlin. You kept them in sync by hand, and findViewById glued them together.

Imperative vs Declarative

Old views were imperative: you found a widget and mutated it step by step, like textView.text = name. You told the UI exactly how to change.

Describe, Don't Mutate

Compose is declarative: you describe what the screen should look like for the current data, and the framework figures out the changes for you.

Text("Hello, " + name)

UI as a Function of State

The core idea: UI is a function of state. Give Compose your data, it draws the screen. Change the data, it redraws what differs.

Goodbye findViewById

No more findViewById and no view binding boilerplate. You reference UI directly as Kotlin functions, so a whole class of null and id bugs disappears.

Less Code, One Language

Everything is Kotlin now. Layout, logic, and styling live together, so the same screen takes far fewer lines and stays in one place.

Recomposition Keeps UI Fresh

When your data changes, Compose runs recomposition: it re-invokes the affected functions and updates only the parts of the screen that actually changed.

Compose Is Google's Future

Compose is the recommended way to build Android UI today. New tutorials, libraries, and Google samples all assume it, so learning it sets you up well.

Same Power, Less Friction

You lose nothing: Compose still gives you Material Design, animations, and lists. It just removes the XML friction that slowed everyone down.

Quick Check

Let's lock in the big shift from the old Android UI model.

Recap: Why Compose

You saw why Compose wins: pure Kotlin, declarative UI, no XML, no findViewById. Describe the screen for your data and let recomposition keep it fresh.

Domande Frequenti

La lezione «Cosa sostituisce Compose: addio XML» è gratuita?

Sì — il testo completo di «Cosa sostituisce Compose: addio XML» è gratuito qui sul web. Per esercitarvi in modo interattivo (un editor di codice integrato e un tutor IA 24/7) e sbloccare il resto del corso Jetpack Compose Academy, passa a CoddyKit PRO. Il corso Jetpack Compose Academy include 4 lezioni in totale.

Cosa imparerò in «Cosa sostituisce Compose: addio XML»?

Scopra perché l'interfaccia dichiarativa è migliore dell'inflazione imperativa delle View. Eserciti Jetpack Compose Academy con codice pratico che esegui direttamente nel browser, e un tutor IA 24/7 risponde alle tue domande mentre lavori sulla lezione.

Ho bisogno di esperienza per iniziare Jetpack Compose Academy?

Non è richiesta alcuna esperienza precedente. Jetpack Compose Academy su CoddyKit è strutturato per principianti e studenti avanzati, quindi puoi iniziare da qui o dall'inizio e procedere al tuo ritmo. Questa è la lezione 1 di 4.

Quanto tempo richiede la lezione «Cosa sostituisce Compose: addio XML»?

La maggior parte delle lezioni CoddyKit richiede circa 5–10 minuti. Ogni lezione è breve e interattiva, quindi fai progressi costanti e riprendi esattamente da dove hai lasciato su web e app.

Posso scrivere ed eseguire codice in questa lezione Jetpack Compose Academy?

Sì. Ogni lezione Jetpack Compose Academy include un editor di codice integrato, quindi scrivi ed esegui codice reale direttamente nel tuo browser e ricevi feedback istantaneo dall'IA — nessuna configurazione locale necessaria.

Tutte le lezioni di questo corso

  1. Cosa sostituisce Compose: addio XML
  2. Configurare Android Studio per Compose
  3. Anatomia di una funzione @Composable
  4. Eseguire la prima app sull'emulatore
← Torna a Jetpack Compose Academy