Compose 中的指针输入
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Compose 提供了多种 API,可帮助您检测用户互动生成的手势。API 涵盖各种用例:
如需详细了解指针输入,请参阅以下页面:
为您推荐
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-27。
[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# Pointer input in Compose\n\nCompose provides a variety of APIs to help you detect gestures that are\ngenerated from user interactions. The APIs cover a wide range of use cases:\n\n- Some of them are **high-level** and designed to cover the most commonly used\n gestures. For example, the\n [`clickable`](/reference/kotlin/androidx/compose/foundation/package-summary#(androidx.compose.ui.Modifier).clickable(kotlin.Boolean,kotlin.String,androidx.compose.ui.semantics.Role,kotlin.Function0))\n modifier allows easy\n detection of a click, and it also provides accessibility features and\n displays visual indicators when tapped (such as ripples).\n\n- There are also less commonly used gesture detectors that offer more\n flexibility on a **lower level** , like\n [`PointerInputScope.detectTapGestures`](/reference/kotlin/androidx/compose/foundation/gestures/package-summary#(androidx.compose.ui.input.pointer.PointerInputScope).detectTapGestures(kotlin.Function1,kotlin.Function1,kotlin.coroutines.SuspendFunction2,kotlin.Function1)) or\n [`PointerInputScope.detectDragGestures`](/reference/kotlin/androidx/compose/foundation/gestures/package-summary#(androidx.compose.ui.input.pointer.PointerInputScope).detectDragGestures(kotlin.Function1,kotlin.Function0,kotlin.Function0,kotlin.Function2))\n but don't include the extra features.\n\nLearn more about pointer input on the following pages:\n\n- [Understand gestures](/develop/ui/compose/touch-input/pointer-input/understand-gestures) gives an explanation of the core concepts playing a role when handling pointer input.\n- [Tap and press](/develop/ui/compose/touch-input/pointer-input/tap-and-press) expands on single pointer, single position events.\n- [Scroll](/develop/ui/compose/touch-input/pointer-input/scroll) explains how to implement scrolling containers, and handles interoperability concerns.\n- [Drag, swipe, and fling](/develop/ui/compose/touch-input/pointer-input/drag-swipe-fling) shows different types of dragging of a single pointer.\n- [Multi-touch](/develop/ui/compose/touch-input/pointer-input/multi-touch) dives into situations where more than one pointer is used.\n\nRecommended for you\n-------------------\n\n- Note: link text is displayed when JavaScript is off\n- [Enable user interactions](/develop/ui/compose/text/user-interactions)\n- [Semantics in Compose](/develop/ui/compose/semantics)\n- [Compose modifiers](/develop/ui/compose/modifiers)"]]