by @alexstyl
✉️ Leave your feedback

← Back to Compose UI

motionEventSpy

Modifier
in
Compose UI
. Since 1.1.0

Overview

Examples

Community Notes

Calls watcher with each MotionEvent that the layout area or any child pointerInput receives. The MotionEvent may or may not have been transformed to the local coordinate system. The Compose View will be considered as handling the MotionEvent in the area that the motionEventSpy is active.

This method can only be used to observe MotionEvents and can not be used to capture an event stream.

watcher is called during the PointerEventPass.Initial pass.

Developers should use pointerInput to handle pointer input processing within Compose. motionEventSpy is only useful as part of Android View interoperability.

Overloads

motionEventSpy

fun Modifier.motionEventSpy(watcher: (motionEvent: MotionEvent) -> Unit)
Next ComponentAndroidView