Jetpack Compose Academy · Ders

İç İçe Kaydırma Bağlantıları

Container'lar arasındaki kaydırmayı koordine edin.

4. ders / 413 adım

İç İçe Kaydırma Bağlantıları, CoddyKit'te ücretsiz bir Jetpack Compose Academy dersidir. Bu, 4 dersinin 4. 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.

Scrolls Inside Scrolls

Sometimes a scrollable sits inside another scrollable, like a list under a collapsing header. Nested scroll lets them cooperate instead of fighting. 📜

The Coordination Problem

Without help, the inner list eats every swipe and the outer container never moves. NestedScrollConnection shares the scroll between them.

Meet nestedScroll

Attach the nestedScroll modifier and pass a connection. That connection intercepts scroll deltas as they travel up the tree.

Modifier.nestedScroll(connection)

Pre-Scroll: First Dibs

The parent gets a chance before the child via onPreScroll. Return how much of the delta you consumed; the rest flows to the child.

override fun onPreScroll(available: Offset, source): Offset

Post-Scroll: Leftovers

After the child scrolls, onPostScroll offers any unused delta back to the parent. Use it to move a header once the list hits its edge.

override fun onPostScroll(consumed, available, source): Offset

Consume What You Need

In each callback you return an Offset of how much you used. Return Offset.Zero to pass everything through to the next participant.

return Offset(0f, consumedY)

Fling Phases Too

There are matching onPreFling and onPostFling callbacks for momentum. They are suspend functions so you can animate as the fling resolves.

override suspend fun onPreFling(available: Velocity): Velocity

Remember the Connection

Wrap your connection in remember so it survives recomposition. Capture any state it reads, like a header offset, inside it.

val connection = remember { object : NestedScrollConnection {...} }

Collapsing Toolbar Classic

The flagship use is a collapsing toolbar: shrink the top bar with pre-scroll while the list scrolls, then expand it on the way back.

It Just Works Often

Many built-ins like Scaffold with scroll behaviors already wire nested scroll for you. Reach for a custom connection only when you need fine control.

Mind the Source

Each callback gets a source telling you if the scroll came from a drag or a fling. Use it to react differently to touch versus momentum.

if (source == NestedScrollSource.Drag) { /* ... */ }

Quick Check

Which callback lets a parent consume scroll before its child does?

Recap: Scrolls in Harmony

You learned NestedScrollConnection with pre and post scroll and fling, the key to collapsing toolbars and cooperating lists. 🎉

Başlamak ücretsiz

Yapay zeka eğitmeniyle Kotlin öğren — ücretsiz

Tarayıcında gerçek kod yaz ve çalıştır, 7/24 yapay zeka eğitmeninden anında yardım al; web'de ya da uygulamada kaldığın yerden devam et.

Kurslar
30
Dersler
120

Sıkça Sorulan Sorular

“İç İçe Kaydırma Bağlantıları” dersi ücretsiz mi?

Evet — “İç İçe Kaydırma Bağlantıları” 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.

“İç İçe Kaydırma Bağlantıları” dersinde ne öğreneceğim?

Container'lar arasındaki kaydırmayı koordine edin. 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 4. dersidir.

“İç İçe Kaydırma Bağlantıları” 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

  1. pointerInput ve detectTapGestures
  2. Sürükleme, Kaydırma ve Fırlatma
  3. Dönüştürme: Kaydırma, Yakınlaştırma ve Döndürme
  4. İç İçe Kaydırma Bağlantıları
← Jetpack Compose Academy Sayfasına Dön