スワイプして表示
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
ユーザーがコンポーネントをスワイプしてその他のアクションを表示できるようにします。

スワイプして表示コンポーネントを使用すると、チップとカードに、特にリストに表示された場合に、追加のアクションを追加できます。このコンポーネントを使用すると、ユーザーは画面から離れることなくすばやく操作できます。
チップやカードを左にスワイプしてこれらのアクションにアクセスし、アクションをタップして完了できます。チップとカードを左にスワイプして、メイン アクションをすばやく実行することもできます。
このコンポーネントには、以下のアクションを行うためのスロットが 2 つあります。
- メイン
- サブ(省略可)
構造
表示されるアクション
デベロッパーは、独自のユースケースに合わせてアクションをカスタマイズできます。これらのアクションで使用される色やアイコンは、ユーザーがその意味を理解できるようにすることを考慮してください。
すべての言語ロケールで、表示されるアクションが同じ側に表示されます。
- メイン アクション
- サブアクション(省略可)
主要なアクションに取り組む
メイン アクションを実行するには、ユーザーはボタンをタップするか、左にスワイプし続けます。この場合、ボタンは画面の幅全体に広がり、ラベルが表示されます。アクションは、選択後にフェードアウトします。
最初の例は、単一ボタンのオプションを示しています。2 つ目の例は、ダブルボタンのオプションを示しています。
操作を元に戻す
破壊的な操作の場合は、元に戻すコンポーネントを追加して、ユーザーが操作を元に戻すことができるようにします。プライマリ アクションに元に戻す機能を追加します。
追加すると、commit されたアクションの代わりにチップを元に戻すボタンが表示されます。しばらくすると、「元に戻す」アクションがフェードアウトし、コミットされたアクションが完了します。
スワイプのしきい値
スワイプしてコンポーネントを表示する操作は、ユーザーが画面をどこまでスワイプするかによって異なります。
- スワイプが画面の 50% 未満の場合、コンポーネントは開始位置にスナップ戻され、アクションは実行されません。
- ユーザーが画面を全幅の 50% ~ 75% の範囲でスワイプすると、コンポーネントは部分的に表示されたままとなり、コンポーネントに関連付けられているアクションが表示されます。
- ユーザーが画面の 75% 以上をスワイプすると、コンポーネントが表示されなくなり、システムが自動的にメイン アクションを実行します。
マテリアルをテーマにした次のコンポーネントは、スワイプ動作を実装しています。
カード上
次のスクリーンショットは、SwipeToRevealCard
クラスを使用している場合に、スワイプしてコンポーネントの外観を表示する様子を示しています。

オンチップ
次のスクリーンショットは、SwipeToRevealChip
クラスを使用している場合に、スワイプしてコンポーネントの外観を表示する様子を示しています。

このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2025-07-27 UTC。
[[["わかりやすい","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 UTC。"],[],[],null,["# Swipe to reveal\n\nAllow users to swipe a component to reveal extra actions.\n\nThe *swipe to reveal* component lets you add extra actions to\nchips and cards, specifically when they appear in lists. This component lets\nusers quickly get things done without leaving the screen.\n\nUsers can partially swipe chips and cards to the left to access these\nactions, then tap on an action to complete it. Users can also fully swipe\nchips and cards to the left to quickly commit to the primary action. \nThe component has 2 slots for these actions:\n\n1. **Primary**\n2. **Secondary (optional)**\n\nAnatomy\n-------\n\n### Revealed actions\n\nDevelopers can customize the actions for their unique use cases. Consider\nthe color and iconography used in these actions to help users understand\nwhat they mean.\n\nThe revealed actions appear on the same side for all language\nlocales.\n\n1. **Primary action**\n2. **Secondary action (optional)** \n\n### Commit to a primary action\n\nTo commit to the primary action, a user can either tap on the button or\ncontinue swiping to the left. In this way, the button extends to the entire\nwidth of the screen and displays a label. The action fades away after being\nselected.\n\nThe first example shows a **single button option** . The\nsecond example shows a **double button option**. \n\n### Undo action\n\nFor destructive actions, add an undo component to let users reverse these\nactions. Add the undo capability to the primary action.\n\nIf added, an undo chip button appears in place of the committed action.\nAfter a short period of time, the undo action fades away, and the system\ncompletes the committed action. \n\n### Swipe thresholds\n\nThe swipe to reveal component's behavior depends upon how far the user\nswipes across the screen:\n\n- If the user swipes across less than 50% of the screen, the component snaps back to its starting position, and no action is taken.\n- If the user swipes across the screen between 50% and 75% of the full width, the component remains partially visible, and the actions associated with the component appear.\n- If the user swipes across more than 75% of the screen, the component disappears, and the system automatically performs the primary action.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nRelated components\n------------------\n\nThe following material-themed components implement the swipe to reveal behavior:\n\n- [`SwipeToRevealCard`](/reference/kotlin/androidx/wear/compose/material/package-summary#SwipeToRevealCard(androidx.wear.compose.material.SwipeToRevealAction,androidx.wear.compose.foundation.RevealState,androidx.compose.ui.Modifier,androidx.wear.compose.material.SwipeToRevealAction,androidx.wear.compose.material.SwipeToRevealAction,androidx.wear.compose.material.SwipeToRevealAction,androidx.wear.compose.material.SwipeToRevealActionColors,androidx.compose.ui.graphics.Shape,kotlin.Function0))\n- [`SwipeToRevealChip`](/reference/kotlin/androidx/wear/compose/material/package-summary#SwipeToRevealChip(androidx.wear.compose.material.SwipeToRevealAction,androidx.wear.compose.foundation.RevealState,androidx.compose.ui.Modifier,androidx.wear.compose.material.SwipeToRevealAction,androidx.wear.compose.material.SwipeToRevealAction,androidx.wear.compose.material.SwipeToRevealAction,androidx.wear.compose.material.SwipeToRevealActionColors,androidx.compose.ui.graphics.Shape,kotlin.Function0))\n\n### On cards\n\nThe following screenshots show the swipe to reveal component's appearance when\nusing the `SwipeToRevealCard` class:\n\n### On chips\n\nThe following screenshots show the swipe to reveal component's appearance when\nusing the `SwipeToRevealChip` class:"]]