Try the Compose way
Jetpack Compose is the recommended UI toolkit for Android. Learn how to use touch and input in Compose.
This document describes how to write apps that let users interact with an app using touch gestures. Android provides a variety of APIs to help you create and detect gestures.
Although your app must not depend on touch gestures for basic behaviors—since the gestures might not be available to all users in all contexts—adding touch-based interaction to your app can greatly increase its usefulness and appeal.
To provide users with a consistent, intuitive experience, your app must follow the accepted Android conventions for touch gestures. The Material Design Gestures document shows you how to use common gestures in Android apps. Also, see Material Motion.
For more information about this topic, read the following related guides:
OverScroller—to produce a scrolling animation in response to a touch event.
ViewGroupto ensure that touch events are correctly dispatched to their target views.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2023-06-02 UTC.