Scaffold:画面の骨組み
標準的なアプリレイアウトのスロットを接続します。
「Scaffold:画面の骨組み」はCoddyKit上の無料Jetpack Compose Academyレッスンです。 これはレッスン1/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはJetpack Compose Academy学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Jetpack Compose Academyコースには全4レッスンが含まれています。
このレッスンの一部はまだ翻訳されておらず、英語で表示されています。
Meet Scaffold
Most app screens share the same skeleton: a bar on top, content in the middle, maybe a button floating below. Scaffold gives you all of that in one Composable. 🏗️
Why Not Just a Column?
You could hand-build bars with a Column, but you would re-solve insets, spacing, and overlaps every time. Scaffold wires those standard pieces together for you.
The Slot Idea
Scaffold works with slots: named spots where you drop a Composable. You fill the slots you want and leave the rest empty.
The content Slot
The one slot you almost always use is content. It is the main body of your screen, and Scaffold hands it the right padding to use.
Scaffold { innerPadding ->
Text("Hello", Modifier.padding(innerPadding))
}Honor innerPadding
That innerPadding keeps your content from hiding under bars. Always apply it to your top-level content, or text can slip beneath the app bar.
The topBar Slot
Drop a bar into the topBar slot and Scaffold pins it to the top, then shrinks the content area so nothing overlaps.
Scaffold(
topBar = { TopAppBar(title = { Text("Home") }) }
) { padding -> }More Slots Available
Scaffold also offers bottomBar, floatingActionButton, and snackbarHost slots. You will meet each one in this course.
Leave Slots Empty
Every slot is optional. A Scaffold with only content is perfectly valid, so you add bars only when a screen actually needs them.
One Scaffold Per Screen
The usual rule is one Scaffold per screen. It frames that whole screen, while smaller Composables fill its content slot.
Scaffold Is Material 3
Import Scaffold from androidx.compose.material3 so its colors and spacing match the rest of your Material You theme.
import androidx.compose.material3.ScaffoldcontainerColor
Set containerColor to paint the screen background behind every slot. Skip it and Scaffold uses your theme's surface color by default.
Quick Check
What is the safest thing to do with the value Scaffold passes to its content lambda?
Recap
Scaffold is your screen skeleton: fill named slots like content and topBar, honor innerPadding, and use one per screen. Next you will style the top bar. 👍
よくある質問
「Scaffold:画面の骨組み」レッスンは無料ですか?
はい。「Scaffold:画面の骨組み」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Jetpack Compose Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Jetpack Compose Academyコースには全4レッスンが含まれています。
「Scaffold:画面の骨組み」で何を学びますか?
標準的なアプリレイアウトのスロットを接続します。 ブラウザで直接実行するハンズオンコードでJetpack Compose Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。
Jetpack Compose Academyを始めるのに経験は必要ですか?
事前経験は必要ありません。CoddyKitのJetpack Compose Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン1/4です。
「Scaffold:画面の骨組み」レッスンにはどのくらい時間がかかりますか?
ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。
このJetpack Compose Academyレッスンでコードを書いて実行できますか?
はい。すべてのJetpack Compose Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。