使用轻触手势
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
本指南介绍了如何编写使用户能通过轻触手势与之进行互动的应用。Android 提供了各种 API,可以帮助您创建和检测手势。
尽管应用不应依赖轻触手势来执行基本行为(因为手势可能无法在所有上下文中供所有用户使用),但向应用添加基于轻触的互动可以极大地提升其实用性和吸引力。
为了向用户提供一致、直观的体验,应用应遵循公认的 Android 轻触手势规范。手势设计指南向您介绍了如何在 Android 应用中使用常用手势。另请参阅 Material Design 的 Material 运动指南。
如需详细了解此主题,请参阅以下相关指南:
课程
- 检测常用手势
- 了解如何使用
GestureDetector
检测基本轻触手势,例如滚动、滑动和点按两次。 - 跟踪触摸和指针移动
- 了解如何跟踪指针移动。
- 以动画方式显示滚动手势
- 了解如何使用滚动条(
Scroller
或 OverScroller
)生成滚动动画以响应轻触事件。 - 处理多点触控手势
- 了解如何检测多指针(手指)手势。
- 拖动并缩放
- 了解如何实现基于轻触的拖动和缩放。
- 在 ViewGroup 中管理触摸事件
- 了解如何在
ViewGroup
中管理触摸事件,以确保将触摸事件正确分配给目标视图。
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 2020-06-03 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"没有我需要的信息"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"太复杂/步骤太多"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"内容需要更新"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"翻译问题"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"示例/代码问题"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"其他"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"易于理解"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"解决了我的问题"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"其他"
}]