יש להחליק כדי לסגור
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
אנימציה של החלקה כדי לסגור משקפת את המעבר כשמשתמשים מנווטים לדף הקודם.
פרטי האנימציה של החלקה כדי לסגור דומים לאלה של לחיצה על RSB. האצבעות שולטת בהתקדמות האנימציה עד 50%.
יש אנימציה נוספת בתצוגת האפליקציה שמקושרת לתנועת הסגירה. מרחק התנועה שמוצג בתצוגת האפליקציה לא זהה למרחק שבו צריך להזיז את האצבע. תצוגת האפליקציה אף פעם לא אמורה לצאת מהקצה של המסך, אלא להציג אפקט של לחיצה עם התנגדות מסוימת.
הטמעה
SwipeDismissableNavHost
מספריית הניווט מספק את תנועת הניווט של החלקה כדי לסגור כברירת מחדל.
גם אם אתם לא משתמשים בספריית הניווט, עדיין תוכלו לתמוך בתנועת הניווט
הזו במסך מלא באמצעות שימוש ב-BasicSwipeToDismissBox
באופן ישיר.
עיצוב
כשאתם מתכננים את הפעולה של החלקה כדי לסגור, חשוב לזכור את שני העקרונות הבאים:
קצה המסך
צריך להביא בחשבון אלמנטים אחרים של ממשק המשתמש שאפשר להחליק, כמו תצוגות של אפליקציות שמחולקות לדפים.
כשאפשר להשתמש בתנועת החלקה כדי לסגור, כדאי להקצות 20% מהקצה של המסך כדי להפעיל את התנועה הזו.
אפשר לראות את הדוגמה הזו מה-Compose Material for Wear OS כדי לקבל דוגמה להחלקה מהקצה כאשר ניתן לגלול את התוכן באופן אופקי.
הסף לחזרה לתצוגת האפליקציה או להישארות בתצוגת האפליקציה
אם המשתמש גרר את האצבע על פני יותר מ-50% מרוחבו של המסך, האפליקציה אמורה להפעיל את שאר האנימציה של החלקה חזרה. אם הוא קטן יותר, האפליקציה אמורה לחזור לתצוגה המלאה שלה.
אם התנועה מהירה, מתעלמים מכלל הסף של 50% ומחליקים חזרה.
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. Java ו-OpenJDK הם סימנים מסחריים או סימנים מסחריים רשומים של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-27 (שעון UTC).
[null,null,["עדכון אחרון: 2025-07-27 (שעון UTC)."],[],[],null,["# Swipe to dismiss\n\n[Swipe to dismiss](/reference/kotlin/androidx/wear/compose/foundation/package-summary#BasicSwipeToDismissBox(androidx.wear.compose.foundation.SwipeToDismissBoxState,androidx.compose.ui.Modifier,kotlin.Any,kotlin.Any,kotlin.Boolean,kotlin.Function2))\nanimation conveys the transition when users navigate to the previous page.\n\nThe animation details for swipe to dismiss are similar to the RSB press. Your\nfinger controls the progress of the animation up to 50%.\n\nThere is an additional animation on the App View that is linked to the dismiss\ngesture. The amount of movement shown on the app view is not exactly the same as\nthe distance that the finger needs to move. The app view should never leave the\nedge of the screen, displaying a squeeze like effect with some resistance.\n\nImplementation\n--------------\n\n[`SwipeDismissableNavHost`](/reference/kotlin/androidx/wear/compose/navigation/package-summary#SwipeDismissableNavHost(androidx.navigation.NavHostController,kotlin.String,androidx.compose.ui.Modifier,kotlin.Boolean,androidx.wear.compose.navigation.SwipeDismissableNavHostState,kotlin.String,kotlin.Function1))\nfrom the [navigation library](/training/wearables/compose/navigation)\nprovides the swipe-to-dismiss navigation gesture by default.\n\nIf you are not using the navigation library, then you can still support this full\nscreen navigation gesture by using [`BasicSwipeToDismissBox`](/reference/kotlin/androidx/wear/compose/foundation/package-summary#BasicSwipeToDismissBox(androidx.wear.compose.foundation.SwipeToDismissBoxState,androidx.compose.ui.Modifier,kotlin.Any,kotlin.Any,kotlin.Boolean,kotlin.Function2))\ndirectly.\n\nDesign\n------\n\nWhen designing the swipe to dismiss action, keep the following two principles\nin mind:\n\n### Edge of the screen\n\nAccount for other UI elements that are swipable, such as paginated app views.\nWhen swipe to dismiss is possible, reserve 20% of the edge of the screen to\ntrigger that motion.\n\nSee this [example from the Compose Material for Wear OS codebase](https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:wear/compose/compose-material/samples/src/main/java/androidx/wear/compose/material/samples/SwipeToDismissBoxSample.kt;l=151)\nfor an example of edge-swiping when the content is horizontally scrollable.\n\n### Threshold to go back or stay on app view\n\nIf the user has dragged their finger across over 50% of the screen width,\nthe app should trigger the rest of the swipe back animation. If it's less than\nthat, the app should snap back to the full app view.\n\nIf the gesture is quick, ignore the 50% threshold rule and swipe back."]]