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.
Menangani ketukan di tampilan jam
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Pengguna dapat berinteraksi dengan tampilan jam Anda dalam berbagai cara.
Misalnya, pengguna dapat mengetuk tampilan jam untuk mengetahui lagu yang sedang diputar atau
melihat agenda hari itu. Wear OS by Google memungkinkan tampilan jam menerima
gestur ketukan tunggal di lokasi tertentu pada tampilan jam, selama tidak ada elemen UI
lain yang juga merespons gestur tersebut.
Untuk mengimplementasikan tampilan jam interaktif, pertama-tama buat
gaya tampilan jam, lalu implementasikan penanganan gestur seperti yang dijelaskan dalam panduan ini.
Menangani peristiwa ketukan
Tampilan jam hanya diberi peristiwa ketuk, yang merupakan peristiwa ketika pengguna meletakkan jari
pada layar di bawah, lalu mengangkatnya. Jika pengguna melakukan jenis gestur lainnya
saat jarinya ada di layar sentuh, tampilan jam akan menerima
peristiwa batal, karena semua gestur lainnya direservasi oleh sistem untuk fungsi lainnya.
Untuk menangani gestur ketuk, gunakan
setTapListener()
untuk menambahkan
TapListener
.
Pemroses dipanggil setiap kali pengguna mengetuk tampilan jam.
Tampilan jam menerima jenis peristiwa sentuh berikut:
-
TapType.DOWN
:
saat pengguna meletakkan jarinya di layar sentuh
-
TapType.UP
:
saat pengguna mengangkat jari dari layar sentuh
-
TapType.CANCEL
:
saat sistem mendeteksi bahwa pengguna melakukan gestur selain ketukan
Peristiwa
TapType.DOWN
dan peristiwa TapType.UP
berturut-turut
diverifikasi sebagai ketukan sesuai dengan nilai yang ditampilkan oleh
android.view.ViewConfiguration.getScaledTouchSlop
.
Jangan picu tindakan saat tampilan jam menerima peristiwa TapType.CANCEL
, karena sistem sudah memproses gestur.
Untuk informasi selengkapnya, lihat onTapEvent
.
Aplikasi contoh tampilan jam menunjukkan praktik terbaik untuk mengonfigurasi tampilan jam.
Konten dan contoh kode di halaman ini tunduk kepada lisensi yang dijelaskan dalam Lisensi Konten. Java dan OpenJDK adalah merek dagang atau merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-07-26 UTC.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Informasi yang saya butuhkan tidak ada","missingTheInformationINeed","thumb-down"],["Terlalu rumit/langkahnya terlalu banyak","tooComplicatedTooManySteps","thumb-down"],["Sudah usang","outOfDate","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Masalah kode / contoh","samplesCodeIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 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."]]