0Pricing
Jetpack Compose Academy · レッスン

ComposableからComposableを呼び出す

小さな部品を組み合わせて大きな画面を作ります。

「ComposableからComposableを呼び出す」はCoddyKit上の無料Jetpack Compose Academyレッスンです。 これはレッスン3/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはJetpack Compose Academy学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Jetpack Compose Academyコースには全4レッスンが含まれています。

このレッスンの一部はまだ翻訳されておらず、英語で表示されています。

Build Big From Small

Real screens are not one giant function. You compose them by calling small Composables from inside larger ones, like nesting building blocks. 🧱

A Composable Calls Another

Inside one Composable you simply call another by name. Here Screen calls Greeting, and Compose draws Greeting where you placed it.

@Composable
fun Screen() {
    Greeting("Compose")
}

Stack Several Calls

List multiple calls one after another and they render in order, top to bottom, just like reading down the function.

@Composable
fun Screen() {
    Header()
    Body()
    Footer()
}

The Composition Tree

These nested calls form a tree. Screen is the parent, and each Composable it calls becomes a child node in the UI hierarchy.

Pass Data Downward

Parents hand data to children through parameters. The parent owns the value and the child just displays what it receives.

@Composable
fun Screen() {
    UserName(name = "Ada")
}

Reuse Everywhere

Because a Composable is just a function, you can reuse it as many times as you like across different screens with different data.

@Composable
fun List() {
    Item("Apple")
    Item("Pear")
}

Extract to Stay Readable

When a function grows long, extract a chunk into its own Composable and call it. The screen reads like a clear outline.

Composables Compose

The name says it all: small pieces combine into bigger ones. Mastering this nesting is the heart of building any Compose UI.

Children Render in Place

A child appears exactly where you call it in the parent. Move the call up or down and the UI moves with it.

@Composable
fun Card() {
    Title()
    Divider()
    Title()
}

Mix Built-in and Custom

You freely mix framework Composables like Text with your own. Compose treats them all the same when building the tree.

@Composable
fun Card() {
    Text("Hi")
    Greeting("there")
}

Think in Components

Designing in Compose means thinking in small reusable components. Each owns one job, and screens become a tidy arrangement of them.

Quick Check

Quick check on composing Composables.

Recap

You can now build screens by nesting Composables: call small ones inside bigger ones, pass data down, and reuse components to form the UI tree. 🎉

よくある質問

「ComposableからComposableを呼び出す」レッスンは無料ですか?

はい。「ComposableからComposableを呼び出す」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Jetpack Compose Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Jetpack Compose Academyコースには全4レッスンが含まれています。

「ComposableからComposableを呼び出す」で何を学びますか?

小さな部品を組み合わせて大きな画面を作ります。 ブラウザで直接実行するハンズオンコードでJetpack Compose Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

Jetpack Compose Academyを始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのJetpack Compose Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン3/4です。

「ComposableからComposableを呼び出す」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このJetpack Compose Academyレッスンでコードを書いて実行できますか?

はい。すべてのJetpack Compose Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. @Composable関数を書く
  2. @Previewによるライブプレビュー
  3. ComposableからComposableを呼び出す
  4. setContent:UIの始まり
← Jetpack Compose Academyに戻る