pointerInput ve detectTapGestures
Dokunmayı, çift dokunmayı ve uzun basmayı algılayın.
pointerInput ve detectTapGestures, CoddyKit'te ücretsiz bir Jetpack Compose Academy dersidir. Bu, 4 dersinin 1. 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 Gateway to Touch
To handle raw touch in Compose you reach for the pointerInput modifier. It gives any element a place to read finger events directly. 👆
Add It to Any Composable
Attach pointerInput in a Modifier chain. Inside its lambda you get a gesture scope where you can listen for taps, drags, and more.
Box(Modifier.pointerInput(Unit) {
// gesture detectors go here
})Detect Simple Taps
The friendliest helper is detectTapGestures. It bundles tap, double tap, long press, and press into one tidy call for you.
detectTapGestures(onTap = { /* tapped */ })A Single Quick Tap
The onTap lambda fires when a finger presses and lifts without moving much. It receives the Offset where the tap landed.
detectTapGestures(onTap = { offset -> println(offset) })Catch a Double Tap
Pass onDoubleTap to react to two quick taps in a row. It is perfect for a like or zoom shortcut on an image. 💙
detectTapGestures(onDoubleTap = { /* zoom in */ })Hold for Long Press
The onLongPress lambda fires after the finger stays down past a threshold. Use it to open context menus or selection mode.
detectTapGestures(onLongPress = { /* show menu */ })Track the Press Itself
Use onPress to know the moment a finger touches down. Its lambda is suspendable, so you can await release or cancellation.
detectTapGestures(onPress = { awaitRelease() })Every Tap Carries Position
Each tap callback hands you an Offset in pixels, measured from the top-left of the composable. Read it to know exactly where the user touched.
The Key Argument Matters
The first argument to pointerInput is a key. When it changes the gesture block restarts, so pass any state your handlers depend on.
Modifier.pointerInput(enabled) { /* restarts if enabled flips */ }Gestures Run in Coroutines
The pointerInput block is a suspend scope. That is why detectors can await events frame by frame without blocking the UI thread.
Combine Several Callbacks
One detectTapGestures call can take tap, double tap, and long press together. Compose figures out which one the user meant.
detectTapGestures(onTap = {...}, onLongPress = {...})Quick Check
Which helper bundles tap, double tap, and long press into one call?
Recap: Raw Taps Made Easy
You met pointerInput and detectTapGestures for tap, double tap, and long press. They are your foundation for custom touch handling. 🎉
Sıkça Sorulan Sorular
“pointerInput ve detectTapGestures” dersi ücretsiz mi?
Evet — “pointerInput ve detectTapGestures” 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.
“pointerInput ve detectTapGestures” dersinde ne öğreneceğim?
Dokunmayı, çift dokunmayı ve uzun basmayı algılayın. 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 1. dersidir.
“pointerInput ve detectTapGestures” 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
- pointerInput ve detectTapGestures
- Sürükleme, Kaydırma ve Fırlatma
- Dönüştürme: Kaydırma, Yakınlaştırma ve Döndürme
- İç İçe Kaydırma Bağlantıları