Compose 中的指標輸入
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
Compose 提供多種 API,協助您偵測使用者互動而產生的手勢。您可以運用各種用途的 API:
想進一步瞭解下列頁面中的指標輸入資料:
- 瞭解手勢:說明處理指標輸入時扮演的角色。
- 輕觸並按下會展開單一指標、單一位置事件。
- Scroll 說明如何實作捲動容器,並處理互通性問題。
- 「拖曳、滑動和快速滑過」會顯示單一指標的各種拖曳類型。
- 多點觸控則深入探討使用多個指標的情況。
為您推薦
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-27 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間: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)"]]