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.
Gestire i tocchi nei quadranti
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Un utente può interagire con il tuo quadrante in molti modi.
Ad esempio, un utente potrebbe toccare il quadrante per sapere quale brano è attualmente in riproduzione o per visualizzare l'agenda della giornata. Wear OS by Google consente ai quadranti di accettare il gesto del singolo tocco in una determinata posizione del quadrante, purché non ci sia un altro elemento UI che risponda al gesto in questione.
Per implementare un quadrante interattivo, crea prima lo stile
del quadrante, quindi implementa la gestione dei gesti come descritto in questa guida.
Gestire gli eventi di tocco
Al quadrante vengono mostrati solo gli eventi di tocco, ovvero gli eventi in cui l'utente appoggia un dito sullo schermo e poi lo solleva. Se l'utente esegue qualsiasi altro tipo di gesto mentre il dito è sul touchscreen, il quadrante riceve un evento di annullamento, poiché tutti gli altri gesti sono riservati dal sistema per altre funzioni.
Per gestire i gesti di tocco, utilizza
setTapListener()
per aggiungere un
TapListener
.
Il listener viene chiamato ogni volta che l'utente tocca il quadrante.
Il quadrante riceve i seguenti tipi di eventi tocco:
-
TapType.DOWN
:
quando l'utente appoggia il dito sul touchscreen
-
TapType.UP
:
quando l'utente solleva il dito dal touchscreen
-
TapType.CANCEL
:
quando il sistema rileva che l'utente esegue un gesto diverso dal tocco
Un evento TapType.DOWN
e il successivo evento TapType.UP
vengono verificati come un tocco in base al valore restituito da android.view.ViewConfiguration.getScaledTouchSlop
.
Non attivare un'azione quando il quadrante riceve un evento TapType.CANCEL
, perché il sistema sta già elaborando il gesto.
Per ulteriori informazioni, vedi onTapEvent
.
L'
app di esempio per il quadrante mostra le best practice per la configurazione di un quadrante.
I campioni di contenuti e codice in questa pagina sono soggetti alle licenze descritte nella Licenza per i contenuti. Java e OpenJDK sono marchi o marchi registrati di Oracle e/o delle sue società consociate.
Ultimo aggiornamento 2025-07-26 UTC.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Mancano le informazioni di cui ho bisogno","missingTheInformationINeed","thumb-down"],["Troppo complicato/troppi passaggi","tooComplicatedTooManySteps","thumb-down"],["Obsoleti","outOfDate","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Problema relativo a esempi/codice","samplesCodeIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 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."]]