Use touch gestures
Stay organized with collections
Save and categorize content based on your preferences.
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:
Topics
-
Detect common gestures
-
Learn how to detect basic touch gestures, such as scrolling, flinging, and double-tapping,
using
GestureDetector
.
-
Track touch and pointer movements
-
Learn how to track movement.
-
Animate a scroll gesture
-
Learn how to use
scrollers—
Scroller
or
OverScroller
—to
produce a scrolling animation in response to a touch event.
-
Handle multi-touch gestures
-
Learn how to detect multi-pointer (finger) gestures.
-
Drag and scale
-
Learn how to implement touch-based dragging and scaling.
- Manage touch events in a ViewGroup
- Learn how to manage touch events in a
ViewGroup
to 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 2024-06-27 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
{"lastModified": "Last updated 2024-06-27 UTC."}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-06-27 UTC."]]