<转换>
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
指定运动序列的开始和结束状态,即目标
中间状态以及触发相应动作的用户互动。
语法
<Transition
motion:constraintSetStart="start"
motion:constraintSetEnd="end"
[ motion:duration="integer" ] >
...
</Transition>
属性
motion:constraintSetStart
- 运动序列的初始状态。可以是
<ConstraintSet>
或布局如需指定 <ConstraintSet>
,请将以下代码
属性
"@+id/constraintSetId"
。要指定布局,请将
将其设为 "@layout/layoutState"
。
motion:constraintSetEnd
- 运动序列的最终状态。可以是
<ConstraintSet>
或布局。如需指定 <ConstraintSet>
,请将以下代码
属性设为 "@+id/constraintSetId"
。要指定
请将其设置为 "@layout/layoutState"
。
motion:duration
- 运动序列的时长(以毫秒为单位)。如果未指定,则
<MotionScene>
元素的 defaultDuration
。
可以包含的元素
<onClick>
- 表示运动序列是由用户触摸触发的。
<onSwipe>
- 表示运动序列是由用户滑动触发的。
<KeyFrameSet>
- 为广告指定一个或多个中间位置或属性设置
元素。
包含于
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-27。
[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# <Transition>\n\nSpecifies the beginning and end state of a motion sequence, the target\nintermediate states, and the user interactions that trigger the motion.\n\nSyntax\n------\n\n```xml\n\u003cTransition\n motion:constraintSetStart=\"start\"\n motion:constraintSetEnd=\"end\"\n [ motion:duration=\"integer\" ] \u003e\n ...\n\u003c/Transition\u003e\n```\n\nAttributes\n----------\n\n`motion:constraintSetStart`\n: Initial state of the motion sequence. This can either be the ID of a\n [`\u003cConstraintSet\u003e`](/training/constraint-layout/motionlayout/ref/constraintset)\n or a layout. To specify a `\u003cConstraintSet\u003e`, set this\n attribute to\n `\"@+id/`\u003cvar translate=\"no\"\u003econstraintSetId\u003c/var\u003e`\"`. To specify a layout, set\n it to `\"@layout/`\u003cvar translate=\"no\"\u003elayoutState\u003c/var\u003e`\"`.\n\n`motion:constraintSetEnd`\n: Final state of the motion sequence. This can either be the ID of a\n `\u003cConstraintSet\u003e`, or a layout. To specify a `\u003cConstraintSet\u003e`, set this\n attribute to `\"@+id/`\u003cvar translate=\"no\"\u003econstraintSetId\u003c/var\u003e`\"`. To specify a\n layout, set it to `\"@layout/`\u003cvar translate=\"no\"\u003elayoutState\u003c/var\u003e`\"`.\n\n`motion:duration`\n: Duration of the motion sequence in milliseconds. If not specified, the\n [`\u003cMotionScene\u003e`](/training/constraint-layout/motionlayout/ref/motionscene)\n element's `defaultDuration` is used.\n\nCan contain\n-----------\n\n[`\u003conClick\u003e`](/training/constraint-layout/motionlayout/ref/onclick)\n: Indicates that the motion sequence is triggered by a user touch.\n\n[`\u003conSwipe\u003e`](/training/constraint-layout/motionlayout/ref/onswipe)\n: Indicates that the motion sequence is triggered by a user swipe.\n\n[`\u003cKeyFrameSet\u003e`](/training/constraint-layout/motionlayout/ref/keyframeset)\n: Specifies one or more intermediate positions or attribute settings for\n elements in the motion sequence.\n\nContained in\n------------\n\n- [`\u003cMotionScene\u003e`](/training/constraint-layout/motionlayout/ref/motionscene)"]]