コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
モーションの過程でビューの位置と属性を指定します。
あります。デフォルトでは、モーションは初期状態から終了状態に進行します。
<KeyFrameSet>
を使用すると、より複雑なモーションを作成できます。
<KeyFrameSet>
には、
<KeyPosition>
または
<KeyAttribute>
説明します。これらのノードでは、特定の時点でのターゲット ビューの位置や属性が
特定できます
MotionLayout
開始点から各中間点までビューを滑らかにアニメーション化します。
最終的に目的地にたどり着きます
モーション シーケンスの初期状態の領域に不透明なボールが含まれていて、
ビューです。最終状態では、ボールが透明になります。
。デフォルトでは、MotionLayout
はボールをスムーズに動かします。
次第に透明になり、その後消えます。
到達するまでですこの動作を変更するには、<KeyFrameSet>
を使用します。
たとえば、ボールを左上隅まで垂直方向に動かすことができます。
完全に不透明のままで、その後、水平方向に
フェードアウトします。これを行うには、<KeyFrameSet>
を作成し、
その中に <KeyPosition>
と <KeyAttribute>
を追加します。<KeyPosition>
はボールの中間位置を指定し、<KeyAttribute>
には
は、動きの中間点でボールが不透明のままであることを指定します。
構文
<KeyFrameSet>
[ <KeyPosition/>... ]
[ <KeyAttribute/>...]
</KeyFrameSet>
親要素
<Transition>
含まれるコンテンツ
<KeyPosition>
- モーション シーケンスの特定の時点におけるビューの位置を指定します。
<KeyAttribute>
- モーション シーケンスの特定の時点におけるビュー属性を指定します。
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。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,["# <KeyFrameSet>\n\nSpecifies location and attributes for views over the course of the motion\nsequence. By default, motion proceeds from the initial state to the end state.\nBy using `\u003cKeyFrameSet\u003e`, you can build more complex motions.\n\nThe `\u003cKeyFrameSet\u003e` contains\n[`\u003cKeyPosition\u003e`](/training/constraint-layout/motionlayout/ref/keyposition) or\n[`\u003cKeyAttribute\u003e`](/training/constraint-layout/motionlayout/ref/keyattribute)\nnodes. These nodes specify the position or attributes of a target view at a\nspecific point in the motion.\n[`MotionLayout`](/reference/androidx/constraintlayout/motion/widget/MotionLayout)\nsmoothly animates the view from the starting point to each intermediate point\nand then to the final destination.\n\nSuppose the initial state of the motion sequence has an opaque ball in the\nlower-left corner of the view, and the final state makes the ball transparent in\nthe upper-right corner. By default, the `MotionLayout` moves the ball smoothly\nin a diagonal line, gradually becoming transparent until it vanishes when it\nreaches its destination. By using `\u003cKeyFrameSet\u003e`, you can change this behavior.\nFor example, you can make the ball move vertically to the upper-left corner\nwhile remaining entirely opaque, then move horizontally to the upper-right\ncorner while fading out. You can do this by creating a `\u003cKeyFrameSet\u003e` and\nadding a `\u003cKeyPosition\u003e` and `\u003cKeyAttribute\u003e` inside it. The `\u003cKeyPosition\u003e`\nspecifies the intermediate location of the ball, and the `\u003cKeyAttribute\u003e`\nspecifies that the ball remains opaque at the midpoint of the motion.\n\nSyntax\n------\n\n```xml\n\u003cKeyFrameSet\u003e\n [ \u003cKeyPosition/\u003e... ]\n [ \u003cKeyAttribute/\u003e...]\n\u003c/KeyFrameSet\u003e\n```\n\nContained in\n------------\n\n[`\u003cTransition\u003e`](/training/constraint-layout/motionlayout/ref/transition)\n\nContains\n--------\n\n[`\u003cKeyPosition\u003e`](/training/constraint-layout/motionlayout/ref/keyposition)\n: Specifies a view's position at a specific moment during the motion sequence.\n\n[`\u003cKeyAttribute\u003e`](/training/constraint-layout/motionlayout/ref/keyattribute)\n: Specifies view attributes at a specific moment during the motion sequence."]]