<Kaydırmada>
Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Kullanıcı, düzeni kaydırdığında gerçekleştirilecek işlemi belirtir. Hızın
hedeflenen görünümün hareket sırası ve hareketinin
(isteğe bağlı olarak ayarladığınız sınırlara tabidir.)
parametreleridir.
Tek bir <Transition>
için birden çok <OnSwipe>
düğümü olabilir. Bu düğümlerin her biri
<OnSwipe>
farklı bir kaydırma yönü ve
gerçekleştirileceğini unutmayın.
Sözdizimi
<OnSwipe
motion:touchAnchorId="@id/target_view"
motion:touchAnchorSide="side"
[ motion:dragDirection="direction" ]
[ motion:dragScale="scale" ]
[ motion:maxVelocity="maxVelocity" ]
[ motion:maxAcceleration="maxAcceleration" ]
/>
Özellikler
motion:touchAnchorId
- Kaydırma işlemiyle hareket eden öğeyi görüntüleyin.
motion:touchAnchorSide
- Kaydırmanın bağlı olduğu hedef görünümün tarafı.
MotionLayout
,
çapa ve kullanıcının parmağı arasındaki sabit mesafe. Kabul edilebilir değerler
"left"
, "right"
, "top"
ve "bottom"
.
motion:dragDirection
- Kullanıcının kaydırma hareketinin yönü. Bu özellik ayarlanırsa
<OnSwipe>
yalnızca belirtilen yöndeki kaydırmalar için geçerlidir. Kabul edilebilir değerler
"dragLeft"
, "dragRight"
, "dragUp"
ve "dragDown"
.
motion:dragScale
Görünümün, kaydırma uzunluğuna göre hareket edeceği mesafeyi kontrol eder. İlgili içeriği oluşturmak için kullanılan
varsayılan değer 1'dir. Bu, görünümün kaydırma hareketine kadar hareket ettiğini gösterir.
dragScale
değeri 1'den küçükse görünüm, kaydırma mesafesinden daha az hareket eder.
Örneğin, 0,5 dragScale
değeri, kaydırmanın 4 cm hareket etmesi durumunda
hedef görüntüleme 2 cm hareket eder.
dragScale
1'den büyükse görünüm kaydırmadan uzağa gider
dokunun. Örneğin, 1,5 dragScale
değeri, kaydırmanın 4 hareket etmesi durumunda
cm, hedef görünüm 6 cm hareket eder.
motion:maxVelocity
Hedef görünümün maksimum hızı.
motion:maxAcceleration
Hedef görünümün maksimum hızı.
İçinde bulunduğu yer:
Bu sayfadaki içerik ve kod örnekleri, İçerik Lisansı sayfasında açıklanan lisanslara tabidir. Java ve OpenJDK, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2025-07-27 UTC.
[[["Anlaması kolay","easyToUnderstand","thumb-up"],["Sorunumu çözdü","solvedMyProblem","thumb-up"],["Diğer","otherUp","thumb-up"]],[["İhtiyacım olan bilgiler yok","missingTheInformationINeed","thumb-down"],["Çok karmaşık / çok fazla adım var","tooComplicatedTooManySteps","thumb-down"],["Güncel değil","outOfDate","thumb-down"],["Çeviri sorunu","translationIssue","thumb-down"],["Örnek veya kod sorunu","samplesCodeIssue","thumb-down"],["Diğer","otherDown","thumb-down"]],["Son güncelleme tarihi: 2025-07-27 UTC."],[],[],null,["# <OnSwipe>\n\nSpecifies the action to perform when the user swipes on the layout. The speed of\nthe motion sequence and the motion of the targeted view are affected by the\nspeed and direction of the swipe, subject to the limits you set with optional\nparameters.\n\nThere can be multiple `\u003cOnSwipe\u003e` nodes for a single `\u003cTransition\u003e`, with each\n`\u003cOnSwipe\u003e` specifying a different swipe direction and a different action to\nperform when the user performs that swipe.\n\nSyntax\n------\n\n```xml\n\u003cOnSwipe\n motion:touchAnchorId=\"@id/target_view\"\n motion:touchAnchorSide=\"side\"\n[ motion:dragDirection=\"direction\" ]\n[ motion:dragScale=\"scale\" ]\n[ motion:maxVelocity=\"maxVelocity\" ]\n[ motion:maxAcceleration=\"maxAcceleration\" ]\n /\u003e\n```\n\nAttributes\n----------\n\n`motion:touchAnchorId`\n: View that is being moved by the swipe.\n\n`motion:touchAnchorSide`\n: Side of the target view that the swipe is anchored to. `MotionLayout` keeps a\n constant distance between the anchor and the user's finger. Acceptable values\n are `\"left\"`, `\"right\"`, `\"top\"`, and `\"bottom\"`.\n\n`motion:dragDirection`\n: Direction of the user's swipe motion. If this attribute is set, this\n `\u003cOnSwipe\u003e` only applies to swipes in the specified direction. Acceptable values\n are `\"dragLeft\"`, `\"dragRight\"`, `\"dragUp\"`, and `\"dragDown\"`.\n\n`motion:dragScale`\n\n: Controls the distance the view moves relative to the length of the swipe. The\n default value is 1, indicating that the view moves as far as the swipe does.\n If `dragScale` is less than 1, the view moves less than the swipe distance.\n For example, a `dragScale` of 0.5 means that if the swipe moves 4 cm, the\n target view moves 2 cm.\n\n If `dragScale` is greater than 1, the view moves farther than the swipe\n distance. For example, a `dragScale` of 1.5 means that if the swipe moves 4\n cm, the target view moves 6 cm.\n\n`motion:maxVelocity`\n\n: Maximum velocity of the target view.\n\n`motion:maxAcceleration`\n\n: Maximum acceleration of the target view.\n\nContained in\n------------\n\n- [`\u003cTransition\u003e`](/training/constraint-layout/motionlayout/ref/transition)"]]