0Pricing
Kotlin Multiplatform Academy · Lektion

Layouts, Modifier und Theming

Adaptive gemeinsame Screens mit Material erstellen

Layouts, Modifier und Theming ist eine kostenlose Kotlin Multiplatform Academy-Lektion auf CoddyKit. Dies ist Lektion 2 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des Kotlin Multiplatform Academy-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der Kotlin Multiplatform Academy-Kurs umfasst insgesamt 4 Lektionen.

Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.

Three Layout Building Blocks

Almost every screen is built from Column, Row and Box. Column stacks children vertically, Row places them side by side, Box layers them.

Column {
    Text("Top")
    Text("Bottom")
}

Rows Place Items Side by Side

A Row arranges its children horizontally. Reach for it when you want a label and a value, or an icon next to text, on one line.

Row {
    Text("Price:")
    Text("$9")
}

Box for Stacking

A Box overlaps its children on the same spot. It is perfect for a badge on top of an avatar or text centered over an image.

Box {
    Image(painter, null)
    Text("New")
}

Modifiers Shape Everything

A Modifier adjusts size, spacing, background and more. You chain calls in order, and the order genuinely changes the result.

Text(
    "Hi",
    modifier = Modifier.padding(16.dp)
)

Order Matters in Chains

Modifiers apply top to bottom. Padding before background insets the color, while background before padding fills behind the padding. Read them like steps.

Modifier
    .background(Blue)
    .padding(8.dp)

Fill and Size the Space

Use fillMaxWidth, fillMaxSize or fixed size to control how much room a composable claims inside its parent layout.

Column(Modifier.fillMaxSize()) {
    Text("Stretched")
}

Arrangement and Alignment

Layout parameters like Arrangement and Alignment position children, for example centering a Row or spacing items evenly across it.

Row(
    horizontalArrangement = Arrangement.SpaceBetween
) { }

Theming with MaterialTheme

Wrap your app in MaterialTheme to supply a color scheme, typography and shapes. Every Material component reads from it automatically.

MaterialTheme(colorScheme = darkColorScheme()) {
    App()
}

Read Theme Values Anywhere

Inside the theme you access tokens through MaterialTheme.colorScheme and typography, so your styling stays consistent across every shared screen.

Text(
    "Title",
    color = MaterialTheme.colorScheme.primary
)

Adapt to Each Platform

The same layout code runs everywhere, yet you can branch on size or platform to make screens adaptive for phones, tablets and desktops.

Consistent by Default

Because layouts, modifiers and theming are all shared, your Android and iOS screens look the same without anyone duplicating styling work.

Quick Check

What does a Modifier do?

Recap: Layout, Modify, Theme

You stacked UI with Column, Row and Box, shaped it with chained modifiers, and applied a shared MaterialTheme so every platform stays consistent. 🎨

Häufig gestellte Fragen

Ist die Lektion „Layouts, Modifier und Theming“ kostenlos?

Ja — der vollständige Text von „Layouts, Modifier und Theming“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des Kotlin Multiplatform Academy-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der Kotlin Multiplatform Academy-Kurs umfasst insgesamt 4 Lektionen.

Was lerne ich in „Layouts, Modifier und Theming“?

Adaptive gemeinsame Screens mit Material erstellen Du übst Kotlin Multiplatform Academy mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.

Brauche ich Erfahrung, um Kotlin Multiplatform Academy zu starten?

Keine Vorkenntnisse erforderlich. Kotlin Multiplatform Academy auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 2 von 4.

Wie lange dauert die Lektion „Layouts, Modifier und Theming“?

Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.

Kann ich in dieser Kotlin Multiplatform Academy-Lektion Code schreiben und ausführen?

Ja. Jede Kotlin Multiplatform Academy-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.

Alle Lektionen in diesem Kurs

  1. Compose Multiplatform aktivieren
  2. Layouts, Modifier und Theming
  3. Zustand und Rekombination in der gemeinsamen UI
  4. Gemeinsame UI auf iOS und Desktop hosten
← Zurück zu Kotlin Multiplatform Academy