This repository was archived by the owner on Dec 27, 2024. It is now read-only.
-
Couldn't load subscription status.
- Fork 172
MotionLayout XML JSON DSL map
John Hoford edited this page Nov 25, 2022
·
12 revisions
XML for MotionLayout works with a
- res/layout/layout_containing_motionlayout.xml
- res/xml/motion_scene.xml
MotionScene XML contains
<MotionScene>
<Transition>
<OnSwipe/>
<OnClick/> - Not implemented in Compose
<KeyFrameSet>
<KeyAttribute/>
<KeyPosition/>
<KeyCycle/>
<KeyTimeCycle/> - Not implemented in Compose
<KeyTrigger/> - Not implemented in Compose
</KeyFrameSet>
</Transition>
<ConstraintSet>
<ViewTransition/> - Not implemented in Compose
<ConstraintSet/>
<include/>
</MotionScene>#Transition
| XML | JSON | DSL | Example |
|---|---|---|---|
| android:id | |||
| constraintSetStart | |||
| constraintSetEnd | |||
| transitionDisable | |||
| layoutDuringTransition | |||
| autoTransition | |||
| motionInterpolator | |||
| duration | |||
| staggered | |||
| transitionFlags |
#OnSwipe
| XML | JSON | DSL | Example |
|---|---|---|---|
| dragScale | |||
| dragThreshold | |||
| autoCompleteMode | |||
| maxVelocity | |||
| maxAcceleration | |||
| springMass | |||
| springStiffness | |||
| springDamping | |||
| springStopThreshold | |||
| springBoundary | |||
| dragDirection | |||
| touchAnchorId | |||
| touchAnchorSide | |||
| rotationCenterId | |||
| touchRegionId | |||
| limitBoundsTo | |||
| nestedScrollFlags | |||
| moveWhenScrollAtTop | |||
| onTouchUp |
#OnClick
| XML | JSON | DSL | Example |
|---|---|---|---|
| targetId | |||
| clickAction |
#KeyFrameSet
In XML KeyFrameSet is a container for KeyAttribute, KeyCycle, and KeyTrigger.
#KeyAttribute
| XML | JSON | DSL | Example |
|---|---|---|---|
| framePosition | |||
| motionTarget | |||
| transitionEasing | |||
| curveFit | |||
| motionProgress | |||
| android:alpha | |||
| android:elevation | |||
| android:rotation | |||
| android:rotationX | |||
| android:rotationY | |||
| android:transformPivotX | |||
| android:transformPivotY | |||
| transformPivotTarget | |||
| transitionPathRotate | |||
| android:scaleX | |||
| android:scaleY | |||
| android:translationX | |||
| android:translationY | |||
| android:translationZ |
#KeyPosition
| XML | JSON | DSL | Example |
|---|---|---|---|
| keyPositionType | |||
| percentX | |||
| percentY | |||
| percentWidth | |||
| percentHeight | |||
| framePosition | |||
| motionTarget | |||
| transitionEasing | |||
| pathMotionArc | |||
| curveFit | |||
| drawPath | |||
| sizePercent |
#KeyCycle
| XML | JSON | DSL | Example |
|---|---|---|---|
| waveShape | |||
| wavePhase | |||
| wavePeriod | |||
| waveOffset | |||
| framePosition | |||
| motionTarget | |||
| transitionEasing | |||
| curveFit | |||
| motionProgress | |||
| android:alpha | |||
| android:elevation | |||
| android:rotation | |||
| android:rotationX | |||
| android:rotationY | |||
| android:transformPivotX | |||
| android:transformPivotY | |||
| transformPivotTarget | |||
| transitionPathRotate | |||
| android:scaleX | |||
| android:scaleY | |||
| android:translationX | |||
| android:translationY | |||
| android:translationZ |
#KeyTimeCycle
Not implemented in Compose
| XML | JSON | DSL | Example |
|---|---|---|---|
| waveShape | |||
| wavePhase | |||
| wavePeriod | |||
| waveOffset | |||
| framePosition | |||
| motionTarget | |||
| transitionEasing | |||
| curveFit | |||
| motionProgress | |||
| android:alpha | |||
| android:elevation | |||
| android:rotation | |||
| android:rotationX | |||
| android:rotationY | |||
| android:transformPivotX | |||
| android:transformPivotY | |||
| transformPivotTarget | |||
| transitionPathRotate | |||
| android:scaleX | |||
| android:scaleY | |||
| android:translationX | |||
| android:translationY | |||
| android:translationZ |
#KeyTrigger Not implemented in Compose
| XML | JSON | DSL | Example |
|---|---|---|---|
| framePosition | |||
| motionTarget | |||
| triggerReceiver | |||
| onNegativeCross | |||
| onPositiveCross | |||
| onCross | |||
| viewTransitionOnNegativeCross | |||
| viewTransitionOnPositiveCross | |||
| viewTransitionOnCross | |||
| triggerSlack | |||
| triggerId | |||
| motion_postLayoutCollision | |||
| motion_triggerOnCollision |
#ViewTransition
Not implemented in Compose
<declare-styleable name="ViewTransition">
<attr name="android:id" />
<attr name="motionTarget" />
<attr name="viewTransitionMode" />
<attr name="onStateTransition" />
<attr name="duration" />
<attr name="upDuration" format="integer" />
<attr name="transitionDisable" />
<attr name="pathMotionArc" />
<attr name="motionInterpolator" />
<attr name="SharedValueId" format="reference"/>
<attr name="SharedValue" format="integer"/>
<attr name="setsTag" format="reference"/>
<attr name="clearsTag" format="reference"/>
<attr name="ifTagSet" format="reference"/>
<attr name="ifTagNotSet" format="reference"/>
</declare-styleable>#ConstraintSet See separate page on on ConstraintSet