กวาดเพื่อปิด
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
กวาดเพื่อปิด
ภาพเคลื่อนไหวจะบอกถึงการเปลี่ยนเมื่อผู้ใช้ไปยังหน้าก่อนหน้า
รายละเอียดภาพเคลื่อนไหวของการปัดเพื่อปิดจะคล้ายกับการกด RSB นิ้วของคุณจะควบคุมความคืบหน้าของภาพเคลื่อนไหวได้สูงสุด 50%
มีภาพเคลื่อนไหวเพิ่มเติมในมุมมองแอปที่ลิงก์กับท่าทางสัมผัสเพื่อปิด จำนวนของการเคลื่อนไหวที่แสดงในมุมมองแอปไม่เท่ากับระยะทางที่นิ้วต้องใช้ในการเคลื่อนที่ มุมมองแอปไม่ควรออกจากขอบหน้าจอ โดยแสดงผลเป็นลักษณะการบีบอัดที่ต้านทานอยู่บ้าง
การใช้งาน
SwipeDismissableNavHost
จากคลังการนำทางจะมีท่าทางสัมผัสในการนําทางด้วยการปัดเพื่อปิดโดยค่าเริ่มต้น
หากไม่ได้ใช้ไลบรารีการนำทาง คุณยังคงรองรับท่าทางสัมผัสในการไปยังส่วนต่างๆ ของหน้าจอแบบเต็มนี้ได้โดยใช้ BasicSwipeToDismissBox
โดยตรง
การออกแบบ
เมื่อออกแบบการปัดเพื่อปิดการทำงาน โปรดคำนึงถึงหลักการ 2 ข้อต่อไปนี้
ขอบของหน้าจอ
พิจารณาองค์ประกอบ UI อื่นๆ ที่ปัดได้ เช่น มุมมองแอปที่ใส่เลขหน้า
เมื่อปัดเพื่อปิดได้ ให้เว้นขอบหน้าจอไว้ 20% เพื่อเรียกใช้การเคลื่อนไหวดังกล่าว
ดูตัวอย่างจาก Codebase ของ Compose สำหรับ 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."]]