TopAppBar ve Eylem Simgeleri
Eylemler içeren bir başlık çubuğu ekleyin.
TopAppBar ve Eylem Simgeleri, CoddyKit'te ücretsiz bir Jetpack Compose Academy dersidir. Bu, 4 dersinin 2. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, Jetpack Compose Academy öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. Jetpack Compose Academy kursu toplamda 4 dersten oluşur.
Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.
The Title Bar
The strip across the top with your screen name and actions is the TopAppBar. It gives users a stable anchor that says where they are. 🧭
A Minimal TopAppBar
At its simplest, a TopAppBar just needs a title. Drop it into the Scaffold topBar slot and you have a real Material header.
TopAppBar(
title = { Text("Inbox") }
)Title Is a Composable
Notice the title takes a Composable lambda, not a String. That means you can put any content there, though usually a single Text fits best.
The navigationIcon Slot
The leading navigationIcon slot holds your back or menu button. Wrap an Icon in an IconButton so it is tappable and sized correctly.
navigationIcon = {
IconButton(onClick = { }) {
Icon(Icons.Default.Menu, "Menu")
}
}The actions Slot
Trailing buttons go in the actions slot. It is a RowScope, so each IconButton you add lines up neatly on the right edge.
actions = {
IconButton(onClick = { }) {
Icon(Icons.Default.Search, "Search")
}
}Always Pass contentDescription
Every Icon in a bar needs a contentDescription. Screen readers announce it, so a Search icon should say Search, not stay silent.
Bar Variants
Material 3 offers CenterAlignedTopAppBar, MediumTopAppBar, and LargeTopAppBar. They differ only in title size and alignment, so pick by feel.
Coloring the Bar
Use TopAppBarDefaults.topAppBarColors to recolor the container and title. Lean on theme colors so the bar stays consistent in light and dark.
colors = TopAppBarDefaults.topAppBarColors(
containerColor = MaterialTheme.colorScheme.primary
)Collapsing Bars
Pass a scrollBehavior and connect it to your content's nested scroll to make large bars shrink as the user scrolls down.
Do Not Overcrowd
Keep actions to two or three icons. Move the rest behind an overflow menu so the bar stays readable on small phones.
Wire It to Scaffold
The bar lives in Scaffold's topBar slot, so the content area shrinks automatically and your screen body never hides behind it.
Scaffold(topBar = { TopAppBar(title = { Text("Home") }) }) { p -> }Quick Check
You add a search IconButton to a TopAppBar. Where does it belong?
Recap
A TopAppBar holds a title, a leading navigationIcon, and trailing actions. Describe every icon, keep it tidy, and place it in the topBar slot. ✨
Sıkça Sorulan Sorular
“TopAppBar ve Eylem Simgeleri” dersi ücretsiz mi?
Evet — “TopAppBar ve Eylem Simgeleri” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve Jetpack Compose Academy kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. Jetpack Compose Academy kursu toplamda 4 dersten oluşur.
“TopAppBar ve Eylem Simgeleri” dersinde ne öğreneceğim?
Eylemler içeren bir başlık çubuğu ekleyin. Jetpack Compose Academy ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.
Jetpack Compose Academy öğrenmeye başlamak için deneyim gerekli mi?
Önceden deneyim gerekmez. CoddyKit'te Jetpack Compose Academy, başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 2. dersidir.
“TopAppBar ve Eylem Simgeleri” dersi ne kadar sürer?
Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.
Bu Jetpack Compose Academy dersinde kod yazıp çalıştırabilir miyim?
Evet. Her Jetpack Compose Academy dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.
Bu kursun tüm dersleri
- Scaffold: Ekran İskeleti
- TopAppBar ve Eylem Simgeleri
- Alt Çubuklar ve Kayan Eylem Düğmeleri
- Snackbars ve SnackbarHostState