The Watch Face Format is required for watch faces to be installed on devices with Wear OS 5 or later pre-installed and for all new watch faces published on Google Play.
Starting in January 2026, the Watch Face Format will be required for watch faces to be installed on all Wear OS devices.
Learn more about the user-facing changes in this Help Center article.
จัดการการแตะบนหน้าปัด
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ผู้ใช้โต้ตอบกับหน้าปัดได้หลายวิธี
เช่น ผู้ใช้อาจแตะหน้าปัดเพื่อดูว่ากำลังเล่นเพลงอะไรอยู่หรือเพื่อดูกำหนดการของวัน Wear OS by Google ช่วยให้หน้าปัดยอมรับท่าทางสัมผัสเดียวที่ตำแหน่งหนึ่งๆ บนหน้าปัด ตราบใดที่ไม่มีองค์ประกอบ UI อื่นที่ตอบสนองต่อท่าทางสัมผัสนั้นด้วย
หากต้องการใช้หน้าปัดแบบอินเทอร์แอกทีฟ ให้สร้างสไตล์หน้าปัดก่อน แล้วใช้การจัดการท่าทางสัมผัสตามที่อธิบายไว้ในคู่มือนี้
จัดการเหตุการณ์การแตะ
หน้าปัดจะได้รับเฉพาะเหตุการณ์การแตะ ซึ่งเป็นเหตุการณ์ที่ผู้ใช้วางนิ้วลงบนหน้าจอแล้วยกขึ้น หากผู้ใช้ทำท่าทางสัมผัสประเภทอื่นๆ ขณะที่นิ้วอยู่บนหน้าจอสัมผัส หน้าปัดจะได้รับเหตุการณ์ยกเลิก เนื่องจากระบบจองท่าทางสัมผัสอื่นๆ ไว้สำหรับฟังก์ชันอื่นๆ
หากต้องการจัดการท่าทางสัมผัส ให้ใช้
setTapListener()
เพื่อเพิ่ม
TapListener
ระบบจะเรียกฟังก์ชันการฟังทุกครั้งที่ผู้ใช้แตะหน้าปัด
หน้าปัดจะรับเหตุการณ์การสัมผัสประเภทต่อไปนี้
ระบบจะยืนยันเหตุการณ์ TapType.DOWN
และเหตุการณ์ TapType.UP
ที่ตามมาเป็นการแตะตามค่าที่ android.view.ViewConfiguration.getScaledTouchSlop
แสดง
อย่าทริกเกอร์การดำเนินการเมื่อหน้าปัดได้รับเหตุการณ์ TapType.CANCEL
เนื่องจากระบบประมวลผลท่าทางสัมผัสอยู่แล้ว
ดูข้อมูลเพิ่มเติมได้ที่ onTapEvent
แอปตัวอย่างหน้าปัดจะแสดงแนวทางปฏิบัติแนะนำในการกำหนดค่าหน้าปัด
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา Java และ OpenJDK เป็นเครื่องหมายการค้าหรือเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[null,null,["อัปเดตล่าสุด 2025-07-26 UTC"],[],[],null,["# Handle taps in watch faces\n\nA user can interact with your watch face in many ways.\nFor example, a user might tap the watch face to learn what song is currently playing or\nto see the day's agenda. Wear OS by Google lets watch faces accept\nthe single-tap gesture at a given location on the watch face, as long as there's not another\nUI element that also responds to that gesture.\n\nTo implement an interactive watch face, first construct the\nwatch face style, and then implement gesture handling as described in this guide.\n\nHandle tap events\n-----------------\n\nThe watch face is only given tap events, which are events where the user puts a finger\ndown on the screen and then lifts it. If the user performs any other\ntype of gesture while their finger is on the touchscreen, the watch face receives a\ncancel event, as all other gestures are reserved by the system for other functions.\n\n\nTo handle tap gestures, use\n[`setTapListener()`](/reference/kotlin/androidx/wear/watchface/WatchFace#setTapListener(androidx.wear.watchface.WatchFace.TapListener)) to add a\n[`TapListener`](/reference/kotlin/androidx/wear/watchface/WatchFace.TapListener).\nThe listener is called whenever the user taps on the watch face.\n\nThe watch face receives the following types of touch events:\n\n- TapType.DOWN:\n when the user puts their finger down on the touchscreen\n\n- TapType.UP:\n when the user lifts the finger from the touchscreen\n\n- TapType.CANCEL:\n when the system detects that the user performs a gesture other than a tap\n\nA\n`TapType.DOWN` event and the successive `TapType.UP`\nevent are verified as a tap according to the value returned by\n[android.view.ViewConfiguration.getScaledTouchSlop](/reference/android/view/ViewConfiguration#getScaledTouchSlop()).\n\nDon't trigger an action when the watch face receives a `TapType.CANCEL`\nevent, because the system is already processing the gesture.\n\nFor more information, see [onTapEvent](https://developer.android.com/reference/androidx/wear/watchface/WatchFace.TapListener#onTapEvent(kotlin.Int,androidx.wear.watchface.TapEvent,androidx.wear.watchface.ComplicationSlot)).\n\nRelated resources\n-----------------\n\n\nThe\n[watch face sample app](https://github.com/android/wear-os-samples) demonstrates the best practices for configuring a watch face."]]