# MotionLayout

Summary:[Nested Classes](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#nestedclasses)\|[Constants](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#constants)\|[Inherited Fields](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#inhfields)\|[Ctors](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#pubctors)\|[Methods](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#pubmethods)\|[Protected Methods](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#promethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#inhmethods)  

# MotionLayout

| This package is part of the Android[support library](https://developer.android.com/topic/libraries/support-library)which is no longer maintained. The Constraint Layout support library has been superseded by the[AndroidX Constraint Layout library](https://developer.android.com/reference/androidx/constraintlayout/classes), which is part of[Jetpack](https://developer.android.com/jetpack). The`MotionLayout`class has been superseded by[`androidx.constraintlayout.motion.widget.MotionLayout`](https://developer.android.com/reference/androidx/constraintlayout/motion/widget/MotionLayout). We recommend using the AndroidX libraries in all new projects. You should also consider[migrating](https://developer.android.com/jetpack/androidx/migrate)existing projects to AndroidX.

`
public


class
MotionLayout
`  
`


``


``

extends `[ConstraintLayout](https://developer.android.com/reference/android/support/constraint/ConstraintLayout)`


``


`

|---|---|---|------------------------------------------------|
| java.lang.Object                                        ||||
| ↳ | ViewGroup                                            |||
|   | ↳ | [android.support.constraint.ConstraintLayout](https://developer.android.com/reference/android/support/constraint/ConstraintLayout) ||
|   |   | ↳ | android.support.constraint.motion.MotionLayout |

<br />

*** ** * ** ***

**A subclass of ConstraintLayout for building animations. Added in 2.0**

This Layout supports transitions between constraint sets defined in MotionScenes

A`MotionLayout`is a[ConstraintLayout](https://developer.android.com/reference/android/support/constraint/ConstraintLayout)which allows you to animate layouts between various states.

**Note:** `MotionLayout`is available as a support library that you can use on Android systems starting with API level 18 (JellyBean MR2).

MotionLayout links to and requires a MotionScene file. The file contains one top level tag "LayoutDescription"

## LayoutDescription

|        Tags        |                         Description                         |
|--------------------|-------------------------------------------------------------|
| `<StateSet> `      | Describes states supported by the system (optional)         |
| `<ConstraintSet> ` | Describes a constraint set                                  |
| `<Transition> `    | Describes a transition between two states or ConstraintSets |

## Transition

|     Attributes     |                                                            Description                                                             |
|--------------------|------------------------------------------------------------------------------------------------------------------------------------|
| android:id         | The id of the Transition                                                                                                           |
| constraintSetStart | ConstraintSet to be used as the start constraints or a layout file to get the constraint from                                      |
| constraintSetEnd   | ConstraintSet to be used as the end constraints or a layout file to get the constraint from                                        |
| motionInterpolator | The ability to set an overall interpolation (easeInOut, linear, etc.)                                                              |
| duration           | Length of time to take to perform the transition                                                                                   |
| staggered          | float: a quick way to stagger the objects moving                                                                                   |
| autoTransition     | automatically transition from one state to another. supports keywords {none, jumpToStart, jumpToEnd, animateToStart, animateToEnd} |
| `<OnSwipe> `       | Adds support for touch handling (optional)                                                                                         |
| `<OnClick> `       | Adds support for triggering transition (optional)                                                                                  |
| `<KeyFrameSet> `   | Describes a set of Key object which modify the animation between constraint sets.                                                  |

<br />

## OnSwipe (optional)

|     Attributes      |                                                                     Description                                                                     |
|---------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|
| touchAnchorId       | Have the drag act as if it is moving the "touchAnchorSide" of this object                                                                           |
| touchRegionId       | Limits the region that the touch can be start in to the bounds of this view (even if the view is invisible)                                         |
| touchAnchorSide     | The side of the object to move with {top\|left\|right\|bottom}                                                                                      |
| maxVelocity         | limit the maximum velocity (in progress/sec) of the animation will on touch up. Default 4                                                           |
| dragDirection       | which side to swipe from {dragUp\|dragDown\|dragLeft\|dragRight}                                                                                    |
| maxAcceleration     | how quickly the animation will accelerate (progress/sec/sec) and decelerate on touch up. Default 1.2                                                |
| dragScale           | scale factor to adjust the swipe by. (e.g. 0.5 would require you to move 2x as much)                                                                |
| moveWhenScrollAtTop | If the swipe is scrolling and View (such as RecyclerView or NestedScrollView) do scroll and transition happen at the same time                      |
| autoComplete        | swipe automatically animates to start or end. Default is true. Warning: turning this off and using time cycles can result in continuous animations. |

<br />

## OnClick (optional)

|  Attributes  |                                                               Description                                                               |
|--------------|-----------------------------------------------------------------------------------------------------------------------------------------|
| motionTarget | What view triggers Transition.                                                                                                          |
| clickAction  | Direction for buttons to move the animation. Or (\|) combination of: toggle, transitionToEnd, transitionToStart, jumpToEnd, jumpToStart |

<br />

## StateSet

|--------------|-------------------------------------|
| defaultState | the constraint set or layout to use |
| `<State> `   | The side of the object to move      |

<br />

## State

|--------------|--------------------------------------------------------------------------|
| android:id   | Id of the State                                                          |
| constraints  | Id of the ConstraintSet or the Layout file                               |
| `<Variant> ` | a different constraintSet/layout to choose if the with or height matches |

## Variant

|-----------------------|-----------------------------------|
| region_widthLessThan  | match if width less than          |
| region_widthMoreThan  | match if width more than          |
| region_heightLessThan | match if height less than         |
| region_heightMoreThan | match if height more than         |
| constraints           | Id of the ConstraintSet or layout |

<br />

## ConstraintSet

|-----------------|--------------------------------------------------------------------------|
| android:id      | The id of the ConstraintSet                                              |
| `<Constraint> ` | A ConstraintLayout Constraints + other attributes associated with a view |

<br />

## Constraint

Constraint supports two forms:

1: All of ConstraintLayout + the ones listed below +`<CustomAttribute> `.

Or

2: Combination of tags:`<Layout> <PropertySet> <Transform> <Motion> <CustomAttribute> `. The advantage of using these is that if not present the attributes are taken from the base layout file. This saves from replicating all the layout tags if only a Motion tag is needed. Ifis used then all layout attributes in the base are ignored.

<br />

|---------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|
| android:id                      | Id of the View                                                                                                                                            |
| \[ConstraintLayout attributes\] | Any attribute that is part of ContraintLayout layout is allowed                                                                                           |
| \[Standard View attributes\]    | A collection of view attributes supported by the system (see below)                                                                                       |
| transitionEasing                | define an easing curve to be used when animating from this point (e.g. curve(1.0,0,0,1.0)) or key words {standard \| accelerate \| decelerate \| linear } |
| pathMotionArc                   | the path will move in arc (quarter eclipses) or key words {startVertical \| startHorizontal \| none }                                                     |
| transitionPathRotate            | (float) rotate object relative to path taken                                                                                                              |
| drawPath                        | draw the path the layout will animate animate                                                                                                             |
| progress                        | call method setProgress(float) on this view (used to talk to nested ConstraintLayouts etc.)                                                               |
| `<CustomAttribute> `            | call a set"name" method via reflection                                                                                                                    |
| `<Layout> `                     | Attributes for the ConstraintLayout e.g. layout_constraintTop_toTopOf                                                                                     |
| `<PropertySet> `                | currently only visibility, alpha, motionProgress,layout_constraintTag.                                                                                    |
| `<Transform> `                  | All the view transform API such as android:rotation.                                                                                                      |
| `<Motion> `                     | Motion Layout control commands such as transitionEasing and pathMotionArc                                                                                 |

<br />

<br />

## Layout

|---------------------------------|--------------------|
| \[ConstraintLayout attributes\] | see for attributes |

## PropertySet

|----------------------|-------------------------------------------------------------------|
| visibility           | set the Visibility of the view. One of Visible, invisible or gone |
| alpha                | setAlpha value                                                    |
| motionProgress       | using reflection call setProgress                                 |
| layout_constraintTag | a tagging string to identify the type of object                   |

## Transform

|----------------------|-----------------------------------------------------------------------------------------------------------------------------|
| android:elevation    | base z depth of the view.                                                                                                   |
| android:rotation     | rotation of the view, in degrees.                                                                                           |
| android:rotationX    | rotation of the view around the x axis, in degrees.                                                                         |
| android:rotationY    | rotation of the view around the y axis, in degrees.                                                                         |
| android:scaleX       | scale of the view in the x direction                                                                                        |
| android:scaleY       | scale of the view in the y direction.                                                                                       |
| android:translationX | translation in x of the view. This value is added post-layout to the left property of the view, which is set by its layout. |
| android:translationY | translation in y of the view. This value is added post-layout to the top property of the view, which is set by its layout   |
| android:translationZ | translation in z of the view. This value is added to its elevation.                                                         |

## Motion

|------------------|----------------------------------------------------------------------------------------------|
| transitionEasing | Defines an acceleration curve.                                                               |
| pathMotionArc    | Says the object should move in a quarter ellipse unless the motion is vertical or horizontal |
| motionPathRotate | set the rotation to the path of the object + this angle.                                     |
| drawPath         | Debugging utility to draw the motion of the path                                             |

## CustomAttribute

|--------------------|-----------------------------------------------------------------------------------------|
| attributeName      | The name of the attribute. Case sensitive. ( MyAttr will look for method setMyAttr(...) |
| customColorValue   | The value is a color looking setMyAttr(int )                                            |
| customIntegerValue | The value is an integer looking setMyAttr(int )                                         |
| customFloatValue   | The value is a float looking setMyAttr(float )                                          |
| customStringValue  | The value is a String looking setMyAttr(String )                                        |
| customDimension    | The value is a dimension looking setMyAttr(float )                                      |
| customBoolean      | The value is true or false looking setMyAttr(boolean )                                  |

<br />

<br />

## KeyFrameSet

This is the container for a collection of Key objects (such as KeyPosition) which provide information about how the views should move

|------------------|-------------------------------------------------------------------------------------------|
| `<KeyPosition>`  | Controls the layout position during animation                                             |
| `<KeyAttribute>` | Controls the post layout properties during animation                                      |
| `<KeyCycle>`     | Controls oscillations with respect to position of post layout properties during animation |
| `<KeyTimeCycle>` | Controls oscillations with respect to time of post layout properties during animation     |
| `<KeyTrigger>`   | trigger callbacks into code at fixed point during the animation                           |

<br />

## KeyPosition

|----------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|
| motionTarget         | Id of the View or a regular expression to match layout_ConstraintTag                                                                                      |
| framePosition        | The point along the interpolation 0 = start 100 = end                                                                                                     |
| transitionEasing     | define an easing curve to be used when animating from this point (e.g. curve(1.0,0,0,1.0)) or key words {standard \| accelerate \| decelerate \| linear } |
| pathMotionArc        | The path will move in arc (quarter eclipses) key words {startVertical \| startHorizontal \| flip \| none }                                                |
| keyPositionType/td\> | how this keyframe's deviation for linear path is calculated {deltaRelative \| pathRelative\|parentRelative}                                               |
| percentX             | (float) percent distance from start to end along X axis (deltaRelative) or along the path in pathRelative                                                 |
| percentY             | (float) Percent distance from start to end along Y axis (deltaRelative) or perpendicular to path in pathRelative                                          |
| percentWidth         | (float) Percent of change in the width. Note if the width does not change this has no effect.This overrides sizePercent.                                  |
| percentHeight        | (float) Percent of change in the width. Note if the width does not change this has no effect.This overrides sizePercent.                                  |
| curveFit             | path is traced                                                                                                                                            |
| drawPath             | Draw the path of the objects layout takes useful for debugging                                                                                            |
| sizePercent          | If the view changes size this controls how growth of the size. (for fixed size objects use KeyAttributes scaleX/X)                                        |
| curveFit             | selects a path based on straight lines or a path based on a monotonic spline {linear\|spline}                                                             |

<br />

<br />

## KeyAttribute

<br />

|------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|
| motionTarget                 | Id of the View or a regular expression to match layout_ConstraintTag                                                                                      |
| framePosition                | The point along the interpolation 0 = start 100 = end                                                                                                     |
| curveFit                     | selects a path based on straight lines or a path based on a monotonic spline {linear\|spline}                                                             |
| transitionEasing             | Define an easing curve to be used when animating from this point (e.g. curve(1.0,0,0,1.0)) or key words {standard \| accelerate \| decelerate \| linear } |
| transitionPathRotate         | (float) rotate object relative to path taken                                                                                                              |
| drawPath                     | draw the path the layout will animate animate                                                                                                             |
| motionProgress               | call method setProgress(float) on this view (used to talk to nested ConstraintLayouts etc.)                                                               |
| \[standard view attributes\] | A collection of post layout view attributes see below                                                                                                     |
| `<CustomAttribute> `         | call a set"name" method via reflection                                                                                                                    |

## CustomAttribute

|--------------------|-----------------------------------------------------------------------------------------|
| attributeName      | The name of the attribute. Case sensitive. ( MyAttr will look for method setMyAttr(...) |
| customColorValue   | The value is a color looking setMyAttr(int )                                            |
| customIntegerValue | The value is an integer looking setMyAttr(int )                                         |
| customFloatValue   | The value is a float looking setMyAttr(float )                                          |
| customStringValue  | The value is a String looking setMyAttr(String )                                        |
| customDimension    | The value is a dimension looking setMyAttr(float )                                      |
| customBoolean      | The value is true or false looking setMyAttr(boolean )                                  |

<br />

<br />

## KeyCycle

|------------------------------|---------------------------------------------------------------------------------------------------|
| motionTarget                 | Id of the View or a regular expression to match layout_ConstraintTag                              |
| framePosition                | The point along the interpolation 0 = start 100 = end                                             |
| \[Standard View attributes\] | A collection of view attributes supported by the system (see below)                               |
| waveShape                    | The shape of the wave to generate {sin\|square\|triangle\|sawtooth\|reverseSawtooth\|cos\|bounce} |
| wavePeriod                   | The number of cycles to loop near this region                                                     |
| waveOffset                   | offset value added to the attribute                                                               |
| transitionPathRotate         | Cycles applied to rotation relative to the path the view is travelling                            |
| progress                     | call method setProgress(float) on this view (used to talk to nested ConstraintLayouts etc.)       |
| `<CustomAttribute> `         | call a set"name" method via reflection (limited to floats)                                        |

## CustomAttribute

|------------------|-----------------------------------------------------------------------------------------|
| attributeName    | The name of the attribute. Case sensitive. ( MyAttr will look for method setMyAttr(...) |
| customFloatValue | The value is a float looking setMyAttr(float )                                          |

## KeyTimeCycle

|------------------------------|---------------------------------------------------------------------------------------------------|
| motionTarget                 | Id of the View or a regular expression to match layout_ConstraintTag                              |
| framePosition                | The point along the interpolation 0 = start 100 = end                                             |
| \[Standard View attributes\] | A collection of view attributes supported by the system (see below)                               |
| waveShape                    | The shape of the wave to generate {sin\|square\|triangle\|sawtooth\|reverseSawtooth\|cos\|bounce} |
| wavePeriod                   | The number of cycles per second                                                                   |
| waveOffset                   | offset value added to the attribute                                                               |
| transitionPathRotate         | Cycles applied to rotation relative to the path the view is travelling                            |
| progress                     | call method setProgress(float) on this view (used to talk to nested ConstraintLayouts etc.)       |
| `<CustomAttribute> `         | call a set"name" method via reflection (limited to floats)                                        |

## CustomAttribute

|------------------|-----------------------------------------------------------------------------------------|
| attributeName    | The name of the attribute. Case sensitive. ( MyAttr will look for method setMyAttr(...) |
| customFloatValue | The value is a float looking setMyAttr(float )                                          |

## KeyTrigger

|----------------------------|-----------------------------------------------------------------------------------------------------------------|
| motionTarget               | Id of the View or a regular expression to match layout_ConstraintTag                                            |
| framePosition              | The point along the interpolation 0 = start 100 = end                                                           |
| onCross                    | (method name) on crossing this position call this methods on the target                                         |
| onPositiveCross            | (method name) on forward crossing of the framePosition call this methods on the target                          |
| onNegativeCross/td\>       | (method name) backward crossing of the framePosition call this methods on the target                            |
| triggerSlack               | (float) do not call trigger again if the framePosition has not moved this fraction away from the trigger point  |
| triggerId                  | (id) call the TransitionListener with this trigger id                                                           |
| motion_postLayoutCollision | Define motion pre or post layout. Post layout is more expensive but captures KeyAttributes or KeyCycle motions. |
| motion_triggerOnCollision  | (id) Trigger if the motionTarget collides with the other motionTarget                                           |

<br />

<br />

## Standard attributes

<br />

|----------------------|-----------------------------------------------------|
| android:visibility   | Android view attribute that                         |
| android:alpha        | Android view attribute that                         |
| android:elevation    | base z depth of the view.                           |
| android:rotation     | rotation of the view, in degrees.                   |
| android:rotationX    | rotation of the view around the x axis, in degrees. |
| android:rotationY    | rotation of the view around the y axis, in degrees. |
| android:scaleX       | scale of the view in the x direction.               |
| android:scaleY       | scale of the view in the y direction.               |
| android:translationX | translation in x of the view.                       |
| android:translationY | translation in y of the view.                       |
| android:translationZ | translation in z of the view.                       |

<br />

<br />

**See also:**

- [ConstraintLayout](https://developer.android.com/reference/android/support/constraint/ConstraintLayout)

## Summary

|                                                                                                         ### Nested classes                                                                                                         ||
|--------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` interface` | [MotionLayout.TransitionListener](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout.TransitionListener) **Added in 2.0** Listener for monitoring events about TransitionLayout. |

|                                                                  ### Constants                                                                  ||
|-------|------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | [DEBUG_SHOW_NONE](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#DEBUG_SHOW_NONE) <br />         |
| `int` | [DEBUG_SHOW_PATH](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#DEBUG_SHOW_PATH) <br />         |
| `int` | [DEBUG_SHOW_PROGRESS](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#DEBUG_SHOW_PROGRESS) <br /> |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ### Inherited fields                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| From class[android.support.constraint.ConstraintLayout](https://developer.android.com/reference/android/support/constraint/ConstraintLayout) |----------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------| | ` protected `[ConstraintLayoutStates](https://developer.android.com/reference/android/support/constraint/ConstraintLayoutStates) | [mConstraintLayoutSpec](https://developer.android.com/reference/android/support/constraint/ConstraintLayout#mConstraintLayoutSpec) <br /> | | ` protected ConstraintWidgetContainer`                                                                                           | [mLayoutWidget](https://developer.android.com/reference/android/support/constraint/ConstraintLayout#mLayoutWidget) <br />                 | |

|                                                                                               ### Public constructors                                                                                               ||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[MotionLayout](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#MotionLayout(Context))`(Context context) `                                                              |
| ` `[MotionLayout](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#MotionLayout(Context,%20AttributeSet))`(Context context, AttributeSet attrs) `                          |
| ` `[MotionLayout](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#MotionLayout(Context,%20AttributeSet,%20int))`(Context context, AttributeSet attrs, int defStyleAttr) ` |

|                                                                                                                                                                                                                                                                         ### Public methods                                                                                                                                                                                                                                                                          ||
|--------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` void`                                                                                                                                    | ` `[fireTrigger](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#fireTrigger(int,%20boolean,%20float))`(int triggerId, boolean positive, float progress) ` This causes the callback onTransitionTrigger to be called                                                                                                                                                             |
| ` `[ConstraintSet](https://developer.android.com/reference/android/support/constraint/ConstraintSet)                                       | ` `[getConstraintSet](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#getConstraintSet(int))`(int id) ` Get the ConstraintSet associated with an id                                                                                                                                                                                                                              |
| ` int[]`                                                                                                                                   | ` `[getConstraintSetIds](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#getConstraintSetIds())`() ` Get the id's of all constraintSets used by MotionLayout                                                                                                                                                                                                                     |
| ` int`                                                                                                                                     | ` `[getCurrentState](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#getCurrentState())`() ` Return the current state id                                                                                                                                                                                                                                                         |
| ` ArrayList<`[MotionScene.Transition](https://developer.android.com/reference/android/support/constraint/motion/MotionScene.Transition)`>` | ` `[getDefinedTransitions](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#getDefinedTransitions())`() ` Get all Transitions known to the system.                                                                                                                                                                                                                                |
| ` int`                                                                                                                                     | ` `[getEndState](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#getEndState())`() ` Gets the state you are currently transition to.                                                                                                                                                                                                                                             |
| ` float`                                                                                                                                   | ` `[getProgress](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#getProgress())`() ` Get current position during an animation.                                                                                                                                                                                                                                                   |
| ` int`                                                                                                                                     | ` `[getStartState](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#getStartState())`() ` Gets the state you are currently transitioning from.                                                                                                                                                                                                                                    |
| ` float`                                                                                                                                   | ` `[getTargetPosition](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#getTargetPosition())`() ` Gets the position you are animating to typically 0 or 1.                                                                                                                                                                                                                        |
| ` long`                                                                                                                                    | ` `[getTransitionTimeMs](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#getTransitionTimeMs())`() ` Gets the time of the currently set animation.                                                                                                                                                                                                                               |
| ` void`                                                                                                                                    | ` `[loadLayoutDescription](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#loadLayoutDescription(int))`(int motionScene) ` This overrides ConstraintLayout and only accepts a MotionScene.                                                                                                                                                                                       |
| ` boolean`                                                                                                                                 | ` `[onNestedFling](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#onNestedFling(View,%20float,%20float,%20boolean))`(View target, float velocityX, float velocityY, boolean consumed) `                                                                                                                                                                                         |
| ` boolean`                                                                                                                                 | ` `[onNestedPreFling](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#onNestedPreFling(View,%20float,%20float))`(View target, float velocityX, float velocityY) `                                                                                                                                                                                                                |
| ` void`                                                                                                                                    | ` `[onNestedPreScroll](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#onNestedPreScroll(View,%20int,%20int,%20int[],%20int))`(View target, int dx, int dy, int[] consumed, int type) `                                                                                                                                                                                          |
| ` void`                                                                                                                                    | ` `[onNestedScroll](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#onNestedScroll(View,%20int,%20int,%20int,%20int,%20int))`(View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int type) `                                                                                                                                                       |
| ` void`                                                                                                                                    | ` `[onNestedScrollAccepted](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#onNestedScrollAccepted(View,%20View,%20int,%20int))`(View child, View target, int axes, int type) `                                                                                                                                                                                                  |
| ` boolean`                                                                                                                                 | ` `[onStartNestedScroll](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#onStartNestedScroll(View,%20View,%20int,%20int))`(View child, View target, int axes, int type) `                                                                                                                                                                                                        |
| ` void`                                                                                                                                    | ` `[onStopNestedScroll](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#onStopNestedScroll(View,%20int))`(View target, int type) `                                                                                                                                                                                                                                               |
| ` boolean`                                                                                                                                 | ` `[onTouchEvent](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#onTouchEvent(MotionEvent))`(MotionEvent event) `                                                                                                                                                                                                                                                               |
| ` void`                                                                                                                                    | ` `[rebuildMotion](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#rebuildMotion())`() ` *This method is deprecated. Please call rebuildScene() instead.*                                                                                                                                                                                                                        |
| ` void`                                                                                                                                    | ` `[rebuildScene](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#rebuildScene())`() ` rebuild the motion Layouts                                                                                                                                                                                                                                                                |
| ` void`                                                                                                                                    | ` `[setInterpolatedProgress](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#setInterpolatedProgress(float))`(float pos) ` Set the transition position between 0 an 1                                                                                                                                                                                                            |
| ` void`                                                                                                                                    | ` `[setOnHide](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#setOnHide(float))`(float progress) `                                                                                                                                                                                                                                                                              |
| ` void`                                                                                                                                    | ` `[setOnShow](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#setOnShow(float))`(float progress) `                                                                                                                                                                                                                                                                              |
| ` void`                                                                                                                                    | ` `[setProgress](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#setProgress(float))`(float pos) ` Set the transition position between 0 an 1                                                                                                                                                                                                                                    |
| ` void`                                                                                                                                    | ` `[setState](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#setState(int,%20int,%20int))`(int id, int screenWidth, int screenHeight) ` Set the State of the Constraint layout.                                                                                                                                                                                                 |
| ` void`                                                                                                                                    | ` `[setTransition](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#setTransition(int,%20int))`(int beginId, int endId) ` Set a transition explicitly between two constraint sets                                                                                                                                                                                                 |
| ` void`                                                                                                                                    | ` `[setTransitionDuration](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#setTransitionDuration(int))`(int milliseconds) `                                                                                                                                                                                                                                                      |
| ` void`                                                                                                                                    | ` `[setTransitionListener](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#setTransitionListener(android.support.constraint.motion.MotionLayout.TransitionListener))`(`[MotionLayout.TransitionListener](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout.TransitionListener)` listener) ` Set a listener to be notified of drawer events. |
| ` void`                                                                                                                                    | ` `[transitionToEnd](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#transitionToEnd())`() ` Animate to the ending position                                                                                                                                                                                                                                                      |
| ` void`                                                                                                                                    | ` `[transitionToStart](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#transitionToStart())`() ` Animate to the starting position                                                                                                                                                                                                                                                |
| ` void`                                                                                                                                    | ` `[transitionToState](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#transitionToState(int))`(int id) ` Animate to the state defined by the id.                                                                                                                                                                                                                                |
| ` void`                                                                                                                                    | ` `[transitionToState](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#transitionToState(int,%20int,%20int))`(int id, int screenWidth, int screenHeight) ` Animate to the state defined by the id.                                                                                                                                                                               |

|                                                                                                                                                          ### Protected methods                                                                                                                                                          ||
|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` void` | ` `[dispatchDraw](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#dispatchDraw(Canvas))`(Canvas canvas) ` Used to draw debugging graphics and to do post layout changes                                                                                                                 |
| ` void` | ` `[onAttachedToWindow](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#onAttachedToWindow())`() `                                                                                                                                                                                      |
| ` void` | ` `[onLayout](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#onLayout(boolean,%20int,%20int,%20int,%20int))`(boolean changed, int left, int top, int right, int bottom) ` <br />                                                                                                       |
| ` void` | ` `[onMeasure](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#onMeasure(int,%20int))`(int widthMeasureSpec, int heightMeasureSpec) ` <br />                                                                                                                                            |
| ` void` | ` `[parseLayoutDescription](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#parseLayoutDescription(int))`(int id) ` block ConstraintLayout from handling layout description                                                                                                             |
| ` void` | ` `[setTransition](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#setTransition(android.support.constraint.motion.MotionScene.Transition))`(`[MotionScene.Transition](https://developer.android.com/reference/android/support/constraint/motion/MotionScene.Transition)` transition) ` |

| ### Inherited methods |
|-----------------------|---|
| From class` `[android.support.constraint.ConstraintLayout](https://developer.android.com/reference/android/support/constraint/ConstraintLayout)` ` |--------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` void`                                                                                                                              | ` `[applyConstraintsFromLayoutParams](https://developer.android.com/reference/android/support/constraint/ConstraintLayout#applyConstraintsFromLayoutParams(boolean,%20View,%20ConstraintWidget,%20android.support.constraint.ConstraintLayout.LayoutParams,%20<any>))`(boolean isInEditMode, View child, ConstraintWidget widget, `[ConstraintLayout.LayoutParams](https://developer.android.com/reference/android/support/constraint/ConstraintLayout.LayoutParams)` layoutParams, ` idToWidget) | | ` boolean`                                                                                                                           | ` `[checkLayoutParams](https://developer.android.com/reference/android/support/constraint/ConstraintLayout#checkLayoutParams(ViewGroup.LayoutParams))`(ViewGroup.LayoutParams p) ` <br />                                                                                                                                                                                                                                                                                                         | | ` `[ConstraintLayout.LayoutParams](https://developer.android.com/reference/android/support/constraint/ConstraintLayout.LayoutParams) | ` `[generateDefaultLayoutParams](https://developer.android.com/reference/android/support/constraint/ConstraintLayout#generateDefaultLayoutParams())`() ` <br />                                                                                                                                                                                                                                                                                                                                   | | ` ViewGroup.LayoutParams`                                                                                                            | ` `[generateLayoutParams](https://developer.android.com/reference/android/support/constraint/ConstraintLayout#generateLayoutParams(ViewGroup.LayoutParams))`(ViewGroup.LayoutParams p) ` <br />                                                                                                                                                                                                                                                                                                   | | ` int`                                                                                                                               | ` `[getMaxHeight](https://developer.android.com/reference/android/support/constraint/ConstraintLayout#getMaxHeight())`() ` The maximum height of this view.                                                                                                                                                                                                                                                                                                                                       | | ` int`                                                                                                                               | ` `[getMaxWidth](https://developer.android.com/reference/android/support/constraint/ConstraintLayout#getMaxWidth())`() `                                                                                                                                                                                                                                                                                                                                                                          | | ` int`                                                                                                                               | ` `[getMinHeight](https://developer.android.com/reference/android/support/constraint/ConstraintLayout#getMinHeight())`() ` The minimum height of this view.                                                                                                                                                                                                                                                                                                                                       | | ` int`                                                                                                                               | ` `[getMinWidth](https://developer.android.com/reference/android/support/constraint/ConstraintLayout#getMinWidth())`() ` The minimum width of this view.                                                                                                                                                                                                                                                                                                                                          | | ` int`                                                                                                                               | ` `[getOptimizationLevel](https://developer.android.com/reference/android/support/constraint/ConstraintLayout#getOptimizationLevel())`() ` Return the current optimization level for the layout resolution                                                                                                                                                                                                                                                                                        | | ` void`                                                                                                                              | ` `[loadLayoutDescription](https://developer.android.com/reference/android/support/constraint/ConstraintLayout#loadLayoutDescription(int))`(int layoutDescription) ` Load a layout description file from the resources.                                                                                                                                                                                                                                                                           | | ` void`                                                                                                                              | ` `[onLayout](https://developer.android.com/reference/android/support/constraint/ConstraintLayout#onLayout(boolean,%20int,%20int,%20int,%20int))`(boolean changed, int left, int top, int right, int bottom) ` <br />                                                                                                                                                                                                                                                                             | | ` void`                                                                                                                              | ` `[onMeasure](https://developer.android.com/reference/android/support/constraint/ConstraintLayout#onMeasure(int,%20int))`(int widthMeasureSpec, int heightMeasureSpec) ` <br />                                                                                                                                                                                                                                                                                                                  | | ` void`                                                                                                                              | ` `[parseLayoutDescription](https://developer.android.com/reference/android/support/constraint/ConstraintLayout#parseLayoutDescription(int))`(int id) ` Subclasses can override the handling of layoutDescription                                                                                                                                                                                                                                                                                 | | ` void`                                                                                                                              | ` `[requestLayout](https://developer.android.com/reference/android/support/constraint/ConstraintLayout#requestLayout())`() ` <br />                                                                                                                                                                                                                                                                                                                                                               | | ` void`                                                                                                                              | ` `[resolveSystem](https://developer.android.com/reference/android/support/constraint/ConstraintLayout#resolveSystem(int,%20int))`(int widthMeasureSpec, int heightMeasureSpec) `                                                                                                                                                                                                                                                                                                                 | | ` void`                                                                                                                              | ` `[setConstraintSet](https://developer.android.com/reference/android/support/constraint/ConstraintLayout#setConstraintSet(android.support.constraint.ConstraintSet))`(`[ConstraintSet](https://developer.android.com/reference/android/support/constraint/ConstraintSet)` set) ` Sets a ConstraintSet object to manage constraints.                                                                                                                                                              | | ` void`                                                                                                                              | ` `[setMaxHeight](https://developer.android.com/reference/android/support/constraint/ConstraintLayout#setMaxHeight(int))`(int value) ` Set the max height for this view                                                                                                                                                                                                                                                                                                                           | | ` void`                                                                                                                              | ` `[setMaxWidth](https://developer.android.com/reference/android/support/constraint/ConstraintLayout#setMaxWidth(int))`(int value) ` Set the max width for this view                                                                                                                                                                                                                                                                                                                              | | ` void`                                                                                                                              | ` `[setMinHeight](https://developer.android.com/reference/android/support/constraint/ConstraintLayout#setMinHeight(int))`(int value) ` Set the min height for this view                                                                                                                                                                                                                                                                                                                           | | ` void`                                                                                                                              | ` `[setMinWidth](https://developer.android.com/reference/android/support/constraint/ConstraintLayout#setMinWidth(int))`(int value) ` Set the min width for this view                                                                                                                                                                                                                                                                                                                              | | ` void`                                                                                                                              | ` `[setOnConstraintsChanged](https://developer.android.com/reference/android/support/constraint/ConstraintLayout#setOnConstraintsChanged(android.support.constraint.ConstraintsChangedListener))`(`[ConstraintsChangedListener](https://developer.android.com/reference/android/support/constraint/ConstraintsChangedListener)` constraintsChangedListener) `                                                                                                                                     | | ` void`                                                                                                                              | ` `[setOptimizationLevel](https://developer.android.com/reference/android/support/constraint/ConstraintLayout#setOptimizationLevel(int))`(int level) ` Set the optimization for the layout resolution.                                                                                                                                                                                                                                                                                            | | ` void`                                                                                                                              | ` `[setState](https://developer.android.com/reference/android/support/constraint/ConstraintLayout#setState(int,%20int,%20int))`(int id, int screenWidth, int screenHeight) ` Set the State of the ConstraintLayout, causing it to load a particular ConstraintSet.                                                                                                                                                                                                                                | ||
| From class` java.lang.Object ` |-------------------|-------------------------------| | ` Object`         | ` clone() `                   | | ` boolean`        | ` equals(Object arg0) `       | | ` void`           | ` finalize() `                | | ` final Class<?>` | ` getClass() `                | | ` int`            | ` hashCode() `                | | ` final void`     | ` notify() `                  | | ` final void`     | ` notifyAll() `               | | ` String`         | ` toString() `                | | ` final void`     | ` wait(long arg0, int arg1) ` | | ` final void`     | ` wait(long arg0) `           | | ` final void`     | ` wait() `                    | ||

## Constants

### DEBUG_SHOW_NONE

```
public static final int DEBUG_SHOW_NONE
```

<br />

<br />

Constant Value: 0 (0x00000000)  

### DEBUG_SHOW_PATH

```
public static final int DEBUG_SHOW_PATH
```

<br />

<br />

Constant Value: 2 (0x00000002)  

### DEBUG_SHOW_PROGRESS

```
public static final int DEBUG_SHOW_PROGRESS
```

<br />

<br />

Constant Value: 1 (0x00000001)

## Public constructors

### MotionLayout

```
public MotionLayout (Context context)
```

<br />

<br />

|         Parameters          ||
|-----------|------------------|
| `context` | `Context` <br /> |

### MotionLayout

```
public MotionLayout (Context context, 
                AttributeSet attrs)
```

<br />

<br />

|            Parameters            ||
|-----------|-----------------------|
| `context` | `Context` <br />      |
| `attrs`   | `AttributeSet` <br /> |

### MotionLayout

```
public MotionLayout (Context context, 
                AttributeSet attrs, 
                int defStyleAttr)
```

<br />

<br />

|              Parameters               ||
|----------------|-----------------------|
| `context`      | `Context` <br />      |
| `attrs`        | `AttributeSet` <br /> |
| `defStyleAttr` | `int` <br />          |

## Public methods

### fireTrigger

```
public void fireTrigger (int triggerId, 
                boolean positive, 
                float progress)
```

This causes the callback onTransitionTrigger to be called

<br />

|                         Parameters                          ||
|-------------|------------------------------------------------|
| `triggerId` | `int`: The id set set with triggerID <br />    |
| `positive`  | `boolean`: for positive transition edge <br /> |
| `progress`  | `float`: the current progress <br />           |

### getConstraintSet

```
public ConstraintSet getConstraintSet (int id)
```

Get the ConstraintSet associated with an id

<br />

|                                                  Returns                                                  ||
|---------------------------------------------------------------------------------------------------|--------|
| [ConstraintSet](https://developer.android.com/reference/android/support/constraint/ConstraintSet) | <br /> |

### getConstraintSetIds

```
public int[] getConstraintSetIds ()
```

Get the id's of all constraintSets used by MotionLayout

<br />

|     Returns     ||
|---------|--------|
| `int[]` | <br /> |

### getCurrentState

```
public int getCurrentState ()
```

Return the current state id

<br />

|            Returns             ||
|-------|-------------------------|
| `int` | current state id <br /> |

### getDefinedTransitions

```
public ArrayList<MotionScene.Transition> getDefinedTransitions ()
```

Get all Transitions known to the system.

<br />

|                                                                      Returns                                                                      ||
|-------------------------------------------------------------------------------------------------------------------------------------------|--------|
| `ArrayList<`[MotionScene.Transition](https://developer.android.com/reference/android/support/constraint/motion/MotionScene.Transition)`>` | <br /> |

### getEndState

```
public int getEndState ()
```

Gets the state you are currently transition to.

<br />

|                      Returns                      ||
|-------|--------------------------------------------|
| `int` | The State you are transitioning to. <br /> |

### getProgress

```
public float getProgress ()
```

Get current position during an animation.

<br />

|                          Returns                           ||
|---------|---------------------------------------------------|
| `float` | current position from 0.0 to 1.0 inclusive <br /> |

### getStartState

```
public int getStartState ()
```

Gets the state you are currently transitioning from. If you are transitioning from an unknown state returns -1

<br />

|                     Returns                     ||
|-------|------------------------------------------|
| `int` | State you are transitioning from. <br /> |

### getTargetPosition

```
public float getTargetPosition ()
```

Gets the position you are animating to typically 0 or 1. This is useful during animation after touch up

<br />

|                        Returns                        ||
|---------|----------------------------------------------|
| `float` | The target position you are moving to <br /> |

### getTransitionTimeMs

```
public long getTransitionTimeMs ()
```

Gets the time of the currently set animation.

<br />

|               Returns               ||
|--------|-----------------------------|
| `long` | time in Milliseconds <br /> |

### loadLayoutDescription

```
public void loadLayoutDescription (int motionScene)
```

This overrides ConstraintLayout and only accepts a MotionScene.

<br />

|                                  Parameters                                  ||
|---------------|---------------------------------------------------------------|
| `motionScene` | `int`: The resource id, or 0 to reset the MotionScene. <br /> |

### onNestedFling

```
public boolean onNestedFling (View target, 
                float velocityX, 
                float velocityY, 
                boolean consumed)
```

<br />

<br />

|          Parameters           ||
|-------------|------------------|
| `target`    | `View` <br />    |
| `velocityX` | `float` <br />   |
| `velocityY` | `float` <br />   |
| `consumed`  | `boolean` <br /> |

|      Returns      ||
|-----------|--------|
| `boolean` | <br /> |

### onNestedPreFling

```
public boolean onNestedPreFling (View target, 
                float velocityX, 
                float velocityY)
```

<br />

<br />

|         Parameters          ||
|-------------|----------------|
| `target`    | `View` <br />  |
| `velocityX` | `float` <br /> |
| `velocityY` | `float` <br /> |

|      Returns      ||
|-----------|--------|
| `boolean` | <br /> |

### onNestedPreScroll

```
public void onNestedPreScroll (View target, 
                int dx, 
                int dy, 
                int[] consumed, 
                int type)
```

<br />

<br />

|        Parameters         ||
|------------|---------------|
| `target`   | `View` <br /> |
| `dx`       | `int` <br />  |
| `dy`       | `int` <br />  |
| `consumed` | `int` <br />  |
| `type`     | `int` <br />  |

### onNestedScroll

```
public void onNestedScroll (View target, 
                int dxConsumed, 
                int dyConsumed, 
                int dxUnconsumed, 
                int dyUnconsumed, 
                int type)
```

<br />

<br />

|          Parameters           ||
|----------------|---------------|
| `target`       | `View` <br /> |
| `dxConsumed`   | `int` <br />  |
| `dyConsumed`   | `int` <br />  |
| `dxUnconsumed` | `int` <br />  |
| `dyUnconsumed` | `int` <br />  |
| `type`         | `int` <br />  |

### onNestedScrollAccepted

```
public void onNestedScrollAccepted (View child, 
                View target, 
                int axes, 
                int type)
```

<br />

<br />

|       Parameters        ||
|----------|---------------|
| `child`  | `View` <br /> |
| `target` | `View` <br /> |
| `axes`   | `int` <br />  |
| `type`   | `int` <br />  |

### onStartNestedScroll

```
public boolean onStartNestedScroll (View child, 
                View target, 
                int axes, 
                int type)
```

<br />

<br />

|       Parameters        ||
|----------|---------------|
| `child`  | `View` <br /> |
| `target` | `View` <br /> |
| `axes`   | `int` <br />  |
| `type`   | `int` <br />  |

|      Returns      ||
|-----------|--------|
| `boolean` | <br /> |

### onStopNestedScroll

```
public void onStopNestedScroll (View target, 
                int type)
```

<br />

<br />

|       Parameters        ||
|----------|---------------|
| `target` | `View` <br /> |
| `type`   | `int` <br />  |

### onTouchEvent

```
public boolean onTouchEvent (MotionEvent event)
```

<br />

<br />

|          Parameters           ||
|---------|----------------------|
| `event` | `MotionEvent` <br /> |

|      Returns      ||
|-----------|--------|
| `boolean` | <br /> |

### rebuildMotion

```
public void rebuildMotion ()
```

<br />

**This method is deprecated.**   
Please call rebuildScene() instead.

rebuild the motion Layouts

<br />

### rebuildScene

```
public void rebuildScene ()
```

rebuild the motion Layouts

<br />

### setInterpolatedProgress

```
public void setInterpolatedProgress (float pos)
```

Set the transition position between 0 an 1

<br />

### setOnHide

```
public void setOnHide (float progress)
```

<br />

<br />

|         Parameters         ||
|------------|----------------|
| `progress` | `float` <br /> |

### setOnShow

```
public void setOnShow (float progress)
```

<br />

<br />

|         Parameters         ||
|------------|----------------|
| `progress` | `float` <br /> |

### setProgress

```
public void setProgress (float pos)
```

Set the transition position between 0 an 1

<br />

### setState

```
public void setState (int id, 
                int screenWidth, 
                int screenHeight)
```

Set the State of the Constraint layout. Causing it to load a particular ConstraintSet. for states with variants the vairant with matching width and height constraintSet will be chosen

<br />

|                     Parameters                     ||
|------|----------------------------------------------|
| `id` | `int`: set the state width and height <br /> |

### setTransition

```
public void setTransition (int beginId, 
                int endId)
```

Set a transition explicitly between two constraint sets

<br />

|                         Parameters                          ||
|-----------|--------------------------------------------------|
| `beginId` | `int`: the id of the start constraint set <br /> |
| `endId`   | `int`: the id of the end constraint set <br />   |

### setTransitionDuration

```
public void setTransitionDuration (int milliseconds)
```

<br />

<br />

|          Parameters          ||
|----------------|--------------|
| `milliseconds` | `int` <br /> |

### setTransitionListener

```
public void setTransitionListener (MotionLayout.TransitionListener listener)
```

Set a listener to be notified of drawer events.

<br />

|                                            Parameters                                             ||
|------------|---------------------------------------------------------------------------------------|
| `listener` | `MotionLayout.TransitionListener`: Listener to notify when drawer events occur <br /> |

**See also:**

- [MotionLayout.TransitionListener](https://developer.android.com/reference/android/support/constraint/motion/MotionLayout.TransitionListener)  

### transitionToEnd

```
public void transitionToEnd ()
```

Animate to the ending position

<br />

### transitionToStart

```
public void transitionToStart ()
```

Animate to the starting position

<br />

### transitionToState

```
public void transitionToState (int id)
```

Animate to the state defined by the id. The id is the id of the ConstraintSet or the id of the State.

<br />

|                   Parameters                   ||
|------|------------------------------------------|
| `id` | `int`: the state to transition to <br /> |

### transitionToState

```
public void transitionToState (int id, 
                int screenWidth, 
                int screenHeight)
```

Animate to the state defined by the id. Width and height may be used in the picking of the id using this StateSet.

<br />

|                                       Parameters                                        ||
|----------------|-------------------------------------------------------------------------|
| `id`           | `int`: the state to transition <br />                                   |
| `screenWidth`  | `int`: the with of the motionLayout used to select the variant <br />   |
| `screenHeight` | `int`: the height of the motionLayout used to select the variant <br /> |

## Protected methods

### dispatchDraw

```
protected void dispatchDraw (Canvas canvas)
```

Used to draw debugging graphics and to do post layout changes

<br />

### onAttachedToWindow

```
protected void onAttachedToWindow ()
```

<br />

<br />

### onLayout

```
protected void onLayout (boolean changed, 
                int left, 
                int top, 
                int right, 
                int bottom)
```

<br />

<br />

|         Parameters          ||
|-----------|------------------|
| `changed` | `boolean` <br /> |
| `left`    | `int` <br />     |
| `top`     | `int` <br />     |
| `right`   | `int` <br />     |
| `bottom`  | `int` <br />     |

### onMeasure

```
protected void onMeasure (int widthMeasureSpec, 
                int heightMeasureSpec)
```

<br />

<br />

|            Parameters             ||
|---------------------|--------------|
| `widthMeasureSpec`  | `int` <br /> |
| `heightMeasureSpec` | `int` <br /> |

### parseLayoutDescription

```
protected void parseLayoutDescription (int id)
```

block ConstraintLayout from handling layout description

<br />

### setTransition

```
protected void setTransition (MotionScene.Transition transition)
```

<br />

<br />

|                  Parameters                   ||
|--------------|---------------------------------|
| `transition` | `MotionScene.Transition` <br /> |