class MotionLayout : ConstraintLayout, NestedScrollingParent3


A subclass of ConstraintLayout that supports animating between various states Added in 2.0

A MotionLayout is a subclass of ConstraintLayout which supports transitions between between various states (ConstraintSet) defined in MotionScenes.

Note:MotionLayout is available as a support library that you can use on Android systems starting with API level 14 (ICS).

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

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
<ViewTransition> Describes a transition of a View within a 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 Overrides the Manhattan distance from the top most view in the list of views.
  • For any view of stagger value S(Vi)
  • With the transition stagger value of TS (from 0.0 - 1.0)
  • The duration of the animation is duration
  • The views animation duration DS = duration * (1 -TS)
  • Call the stagger fraction SFi = (S(Vi) - S(V0)) / (S(Vn) - S(V0))
  • The view starts animating at: (duration-DS) * SFi
pathMotionArc The path will move in arc (quarter ellipses) key words {startVertical | startHorizontal | flip | none }
autoTransition automatically transition from one state to another. key words {none, jumpToStart, jumpToEnd, animateToStart, animateToEnd}
transitionFlags flags that adjust the behaviour of Transitions. supports {none, beginOnFirstDraw} begin on first draw forces the transition's clock to start when it is first displayed not when the begin is called
layoutDuringTransition Configures MotionLayout on how to react to requestLayout calls during transitions. Allowed values are {ignoreRequest, honorRequest}
<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.
  • A transition is typically defined by specifying its start and end ConstraintSets. You also have the possibility to not specify them, in which case such transition will become a Default transition. That Default transition will be applied between any state change that isn't explicitly covered by a transition.
  • The starting state of the MotionLayout is defined to be the constraintSetStart of the first transition.
  • If no transition is specified (or only a default Transition) the MotionLayout tag must contain a app:currentState to define the starting state of the MotionLayout

ViewTransition

Attributes Description
android:id The id of the ViewTransition
viewTransitionMode currentState, allStates, noState transition affect the state of the view in the current constraintSet or all ConstraintSets or non if noState the ViewTransitions are run asynchronous
onStateTransition actionDown or actionUp run transition if on touch down or up if view matches motionTarget
motionInterpolator The ability to set an overall interpolation key words {easeInOut, linear, etc.}
duration Length of time to take to perform the ViewTransition
pathMotionArc The path will move in arc (quarter ellipses) key words {startVertical | startHorizontal | flip | none }
motionTarget Apply ViewTransition matching this string or id.
setsTag set this tag at end of transition
clearsTag clears this tag at end of transition
ifTagSet run transition if this tag is set on view
ifTagNotSet run transition if this tag is not set on view/td>
<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.
  • A Transition is typically defined by specifying its start and end ConstraintSets. You also have the possibility to not specify them, in which case such transition will become a Default transition. That Default transition will be applied between any state change that isn't explicitly covered by a transition.
  • The starting state of the MotionLayout is defined to be the constraintSetStart of the first transition.
  • If no transition is specified (or only a default Transition) the MotionLayout tag must contain a app:currentState to define the starting state of the MotionLayout

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)
dragThreshold How much to drag before swipe gesture runs. Important for mult-direction swipe. Default is 10. 1 is very sensitive.
moveWhenScrollAtTop If the swipe is scrolling and View (such as RecyclerView or NestedScrollView) do scroll and transition happen at the same time
onTouchUp Support for various swipe modes autoComplete,autoCompleteToStart,autoCompleteToEnd,stop,decelerate,decelerateAndComplete

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

StateSet

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

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

ConstraintSet

android:id The id of the ConstraintSet
deriveConstraintsFrom The id of another constraintSet which defines the constraints not define in this set. If not specified the layout defines the undefined constraints.
<Constraint> A ConstraintLayout Constraints + other attributes associated with a view

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. If is used then all layout attributes in the base are ignored.

android:id Id of the View
[ConstraintLayout attributes] Any attribute that is part of ConstraintLayout 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 ellipses) 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

Layout

[ConstraintLayout attributes] Also see ConstraintLayout.LayoutParams 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 th e 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 )

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

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 ellipses) key words {startVertical | startHorizontal | flip | none }
keyPositionType 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}

KeyAttribute

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](except visibility) 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 )

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 t arget
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
viewTransitionOnCross (ViewTransition Id) start a NoState view transition on crossing or hitting target
viewTransitionOnPositiveCross (ViewTransition Id) start a NoState view transition forward crossing of the framePosition or entering target
viewTransitionOnNegativeCross/td> (ViewTransition Id) start a NoState view transition backward crossing of the framePosition or leaving 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

Standard attributes

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.

Summary

Nested types

protected interface MotionLayout.MotionTracker

Subclasses can override to build test frameworks

Listener for monitoring events about TransitionLayout.

Public constructors

MotionLayout(context: Context, attrs: AttributeSet?)
MotionLayout(context: Context, attrs: AttributeSet?, defStyleAttr: Int)

Public functions

Unit

adds a listener to be notified of drawer events.

Boolean
applyViewTransition(
    viewTransitionId: Int,
    motionController: MotionController!
)

Apply the view transitions keyFrames to the MotionController.

ConstraintSet!

Creates a ConstraintSet based on an existing constraintSet.

Unit
enableTransition(transitionID: Int, enable: Boolean)

Disable the transition based on transitionID

Unit
enableViewTransition(viewTransitionId: Int, enable: Boolean)

Enable a ViewTransition ID.

Unit
fireTrigger(triggerId: Int, positive: Boolean, progress: Float)

This causes the callback onTransitionTrigger to be called

ConstraintSet!

Get the ConstraintSet associated with an id This returns a link to the constraintSet But in most cases can be used. createConstraintSet makes a copy which is more expensive.

@IdRes IntArray<Int>!

Get the id's of all constraintSets used by MotionLayout

Int

Return the current state id

ArrayList<MotionScene.Transition!>!

Get all Transitions known to the system.

DesignTool!
Int

Gets the state you are currently transition to.

IntArray<Int>!

Get the id's of all constraintSets with the matching types

Float

Get current position during an animation.

MotionScene!

Get the motion scene of the layout.

Int

Gets the state you are currently transitioning from.

Float

Gets the position you are animating to typically 0 or 1.

MotionScene.Transition!

This returns the internal Transition Structure

Bundle!
Long

Gets the time of the currently set animation.

Float

Returns the last velocity used in the transition

Unit
getViewVelocity(
    view: View!,
    posOnViewX: Float,
    posOnViewY: Float,
    returnVelocity: FloatArray!,
    type: Int
)

Returns the last layout velocity used in the transition

Boolean

Is initial state changes are applied during onAttachedToWindow or after.

Boolean
Boolean

Determines whether MotionLayout's touch &click handling are enabled.

Boolean
isViewTransitionEnabled(viewTransitionId: Int)

Is transition id enabled or disabled

Unit

This jumps to a state It will be at that state after one repaint cycle If the current transition contains that state.

Unit
loadLayoutDescription(motionScene: Int)

This overrides ConstraintLayout and only accepts a MotionScene.

Boolean

Intercepts the touch event to correctly handle touch region id handover

Boolean
onNestedFling(
    target: View,
    velocityX: Float,
    velocityY: Float,
    consumed: Boolean
)
Boolean
onNestedPreFling(target: View, velocityX: Float, velocityY: Float)
Unit
onNestedPreScroll(
    target: View,
    dx: Int,
    dy: Int,
    consumed: IntArray,
    type: Int
)

React to a nested scroll in progress before the target view consumes a portion of the scroll.

Unit
onNestedScroll(
    target: View,
    dxConsumed: Int,
    dyConsumed: Int,
    dxUnconsumed: Int,
    dyUnconsumed: Int,
    type: Int
)

React to a nested scroll in progress.

Unit
onNestedScroll(
    target: View,
    dxConsumed: Int,
    dyConsumed: Int,
    dxUnconsumed: Int,
    dyUnconsumed: Int,
    type: Int,
    consumed: IntArray!
)

React to a nested scroll in progress.

Unit
onNestedScrollAccepted(child: View, target: View, axes: Int, type: Int)

React to the successful claiming of a nested scroll operation.

Unit
onRtlPropertiesChanged(layoutDirection: Int)
Boolean
onStartNestedScroll(child: View, target: View, axes: Int, type: Int)

React to a descendant view initiating a nestable scroll operation, claiming the nested scroll operation if appropriate.

Unit
onStopNestedScroll(target: View, type: Int)

React to a nested scroll operation ending.

Boolean
Unit
onViewAdded(view: View!)
Unit
Unit

This function is deprecated.

Please call rebuildScene() instead.

Unit

rebuild the motion Layouts

Boolean

adds a listener to be notified of drawer events.

Unit
Unit
rotateTo(id: Int, duration: Int)

Rotate the layout based on the angle to a ConstraintSet

Unit

on completing the current transition, transition to this state.

Unit
setDebugMode(debugMode: Int)

Display the debugging information such as paths information

Unit

Initial state changes are applied during onAttachedToWindow unless this is set to true.

Unit

Enables (or disables) MotionLayout's onClick and onSwipe handling.

Unit

Set the transition position between 0 an 1

Unit
setOnHide(progress: Float)

Notify OnHide motion helpers

Unit
setOnShow(progress: Float)

Notify OnShow motion helpers

Unit

Set the transition position between 0 an 1

Unit
setProgress(pos: Float, velocity: Float)

Set the transition position between 0 an 1

Unit

Sets a motion scene to the layout.

Unit
setState(id: Int, screenWidth: Int, screenHeight: Int)

Set the State of the Constraint layout.

Unit
setTransition(transitionId: Int)

Set a transition explicitly to a Transition that has an ID The transition must have been named with android:id=...

Unit
setTransition(beginId: Int, endId: Int)

Set a transition explicitly between two constraint sets

Unit
setTransitionDuration(milliseconds: Int)

Change the current Transition duration.

Unit

Set a listener to be notified of drawer events.

Unit

Set the transition state as a bundle

String!
Unit
touchAnimateTo(touchUpMode: Int, position: Float, currentVelocity: Float)
Unit
touchSpringTo(position: Float, currentVelocity: Float)

Allows you to use trigger spring motion touch behaviour.

Unit

Animate to the ending position of the current transition.

Unit
transitionToEnd(onComplete: Runnable!)

Animate to the ending position of the current transition.

Unit

Animate to the starting position of the current transition.

Unit

Animate to the starting position of the current transition.

Unit

Animate to the state defined by the id.

Unit
transitionToState(id: Int, duration: Int)

Animate to the state defined by the id.

Unit
transitionToState(id: Int, screenWidth: Int, screenHeight: Int)

Animate to the state defined by the id.

Unit
transitionToState(
    id: Int,
    screenWidth: Int,
    screenHeight: Int,
    duration: Int
)

Animate to the state defined by the id.

Unit

Not sure we want this

Unit
updateState(stateId: Int, set: ConstraintSet!)

update a ConstraintSet under the id.

Unit
updateStateAnimate(stateId: Int, set: ConstraintSet!, duration: Int)

Update a ConstraintSet but animate the change.

Unit
viewTransition(viewTransitionId: Int, view: Array<View!>!)

Execute a ViewTransition.

Protected functions

Unit
dispatchDraw(canvas: Canvas!)

Used to draw debugging graphics and to do post layout changes

Unit

This causes the callback TransitionCompleted to be called

Long

Subclasses can override to define testClasses

MotionLayout.MotionTracker!

Subclasses can override to build test frameworks

Unit
Unit
onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int)
Unit
onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int)
Unit

block ConstraintLayout from handling layout description

Unit

Public properties

java-static Boolean

Protected properties

Boolean

Inherited Constants

From androidx.constraintlayout.widget.ConstraintLayout
const Int
const String!
VERSION = "ConstraintLayout-2.2.0-alpha04"
From android.view.View
const Int
const Int
const Int
const Int
const Int
const Int
const Property<View!, Float!>!
const Int
const String!
AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE = "creditCardExpirationDate"
const String!
AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DAY = "creditCardExpirationDay"
const String!
AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH = "creditCardExpirationMonth"
const String!
AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR = "creditCardExpirationYear"
const String!
const String!
AUTOFILL_HINT_CREDIT_CARD_SECURITY_CODE = "creditCardSecurityCode"
const String!
const String!
const String!
const String!
const String!
const String!
const String!
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const Int
const Int
const Int
const Int
const Int
const Int
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const Int
const Int
const Int
const Int
const Int
const Int
const Int
GONE = 8
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
KEEP_SCREEN_ON = 67108864
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
NO_ID = -1
const Int
const Int
const Int
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const IntArray<Int>!
const Property<View!, Float!>!
const Property<View!, Float!>!
const Property<View!, Float!>!
const Property<View!, Float!>!
const Property<View!, Float!>!
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const IntArray<Int>!
const IntArray<Int>!
const Int
const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Property<View!, Float!>!
const Property<View!, Float!>!
const Property<View!, Float!>!
const String!
VIEW_LOG_TAG = "View"
const Int
const IntArray<Int>!
const Property<View!, Float!>!
const Property<View!, Float!>!
const Property<View!, Float!>!
From android.view.ViewGroup
const Int
const Int
const Int
const Int
const Int
const Int
const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

const Int

This property is deprecated.

Inherited functions

From androidx.constraintlayout.widget.ConstraintLayout
Unit

a ValueModify to the ConstraintLayout.

Unit
applyConstraintsFromLayoutParams(
    isInEditMode: Boolean,
    child: View!,
    widget: ConstraintWidget!,
    layoutParams: ConstraintLayout.LayoutParams!,
    idToWidget: SparseArray<ConstraintWidget!>!
)
Boolean
Boolean
dynamicUpdateConstraints(widthMeasureSpec: Int, heightMeasureSpec: Int)

This can be overridden to change the way Modifiers are used.

Unit
fillMetrics(metrics: Metrics!)
Unit
ConstraintLayout.LayoutParams!
ConstraintLayout.LayoutParams!
ViewGroup.LayoutParams!
Any!
getDesignInformation(type: Int, value: Any!)
Int

The maximum height of this view.

Int
Int

The minimum height of this view.

Int

The minimum width of this view.

Int

Return the current optimization level for the layout resolution

String!

Returns a JSON5 string useful for debugging the constraints actually applied.

java-static SharedValues!

Returns the SharedValues instance, creating it if it doesn't exist.

View!
ConstraintWidget!
Boolean
Unit
resolveMeasuredDimension(
    widthMeasureSpec: Int,
    heightMeasureSpec: Int,
    measuredWidth: Int,
    measuredHeight: Int,
    isWidthMeasuredTooSmall: Boolean,
    isHeightMeasuredTooSmall: Boolean
)

Handles calling setMeasuredDimension()

Unit
resolveSystem(
    layout: ConstraintWidgetContainer!,
    optimizationLevel: Int,
    widthMeasureSpec: Int,
    heightMeasureSpec: Int
)

Handles measuring a layout

Unit

Sets a ConstraintSet object to manage constraints.

Unit
setDesignInformation(type: Int, value1: Any!, value2: Any!)
Unit
setId(id: Int)
Unit
setMaxHeight(value: Int)

Set the max height for this view

Unit
setMaxWidth(value: Int)

Set the max width for this view

Unit
setMinHeight(value: Int)

Set the min height for this view

Unit
setMinWidth(value: Int)

Set the min width for this view

Unit
setOnConstraintsChanged(
    constraintsChangedListener: ConstraintsChangedListener!
)

Notify of constraints changed

Unit

Set the optimization for the layout resolution.

Unit
setSelfDimensionBehaviour(
    layout: ConstraintWidgetContainer!,
    widthMode: Int,
    widthSize: Int,
    heightMode: Int,
    heightSize: Int
)
Boolean
From androidx.core.view.NestedScrollingParent
abstract Int

Return the current axes of nested scrolling for this NestedScrollingParent.

abstract Unit
onNestedPreScroll(target: View, dx: Int, dy: Int, consumed: IntArray)

React to a nested scroll in progress before the target view consumes a portion of the scroll.

abstract Unit
onNestedScroll(
    target: View,
    dxConsumed: Int,
    dyConsumed: Int,
    dxUnconsumed: Int,
    dyUnconsumed: Int
)

React to a nested scroll in progress.

abstract Unit
onNestedScrollAccepted(child: View, target: View, axes: Int)

React to the successful claiming of a nested scroll operation.

abstract Boolean
onStartNestedScroll(child: View, target: View, axes: Int)

React to a descendant view initiating a nestable scroll operation, claiming the nested scroll operation if appropriate.

abstract Unit

React to a nested scroll operation ending.

From android.view.View
Unit
Unit
Unit
ViewPropertyAnimator!
Unit
Unit
Boolean
Unit
Unit

This function is deprecated.

Unit
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Unit
Unit
Unit
Boolean
Unit
Unit
java-static Int
combineMeasuredStates(curState: Int, newState: Int)
Int
Int
Int
Unit
WindowInsets!
computeSystemWindowInsets(in: WindowInsets!, outLocalInsets: Rect!)
Int
Int
Int
AccessibilityNodeInfo!
Unit
Unit

This function is deprecated.

Boolean
Boolean
dispatchNestedFling(velocityX: Float, velocityY: Float, consumed: Boolean)
Boolean
dispatchNestedPreFling(velocityX: Float, velocityY: Float)
Boolean
dispatchNestedPrePerformAccessibilityAction(
    action: Int,
    arguments: Bundle!
)
Boolean
dispatchNestedPreScroll(
    dx: Int,
    dy: Int,
    consumed: IntArray!,
    offsetInWindow: IntArray!
)
Boolean
dispatchNestedScroll(
    dxConsumed: Int,
    dyConsumed: Int,
    dxUnconsumed: Int,
    dyUnconsumed: Int,
    offsetInWindow: IntArray!
)
Boolean
Unit
draw(canvas: Canvas!)
Unit
OnBackInvokedDispatcher!
T!
<T : View?> findViewById(id: Int)
T!
<T : View?> findViewWithTag(tag: Any!)
Boolean

This function is deprecated.

Unit
forceHasOverlappingRendering(hasOverlappingRendering: Boolean)
Unit
Unit
generateDisplayHash(
    hashAlgorithm: String!,
    bounds: Rect!,
    executor: Executor!,
    callback: DisplayHashResultCallback!
)
java-static Int
View.AccessibilityDelegate!
Int
AccessibilityNodeProvider!
CharSequence!
Int
Int
String!
String!
Float
Animation!
Matrix!
IBinder!
IntArray<Int>!
(Mutable)Map<Int!, Int!>!
Array<String!>!
AutofillId!
Int
AutofillValue!
Drawable!
BlendMode!
ColorStateList!
PorterDuff.Mode!
Int
Int
Float
Int
Float
Rect!
Boolean
getClipBounds(outRect: Rect!)
Boolean
ContentCaptureSession!
CharSequence!
Context!
ContextMenu.ContextMenuInfo!
Boolean
java-static Int
getDefaultSize(size: Int, measureSpec: Int)
Display!
IntArray<Int>!
Bitmap!

This function is deprecated.

Int

This function is deprecated.

Int

This function is deprecated.

Unit
getDrawingRect(outRect: Rect!)
Long
Float
Int
Boolean
Boolean
Int
ArrayList<View!>!
getFocusables(direction: Int)
Unit
Drawable!
Int
BlendMode!
ColorStateList!
PorterDuff.Mode!
Boolean
getGlobalVisibleRect(r: Rect!, globalOffset: Point!)
Handler!
Float
Float
Float
Float
Runnable!
Boolean
Int
Unit
getHitRect(outRect: Rect!)
Int
Int
Drawable!
Drawable!
Int
Int
Int
Int
Boolean
KeyEvent.DispatcherState!
Int
Int
Int
ViewGroup.LayoutParams!
Int
Float
Int
Boolean
Unit
Unit
Unit
Matrix!
Int
Int
Int
Int
Int
Int
Int
Int
Int
Int
Int
Int
Int
View.OnFocusChangeListener!
Int
ViewOutlineProvider!
Int
Int
ViewOverlay!
Int
Int
Int
Int
Int
Int
ViewParent!
ViewParent!
Float
Float
PointerIcon!
(Mutable)List<Rect!>!
Array<String!>!
Resources!
Boolean
Int
Float
Int
AttachedSurfaceControl!
View!
WindowInsets!
Float
Float
Float
Float
Float
Int
Int
Int
Int
Int
Int
Int
Int
Int
Int
CharSequence!
StateListAnimator!
Int
Int
(Mutable)List<Rect!>!
Int

This function is deprecated.

Any!
Int
Int
CharSequence!
Int
Float
Int
TouchDelegate!
ArrayList<View!>!
Float
String!
Float
Float
Float
Long
Int
Int
Drawable!
Drawable!
Int
ViewTranslationResponse!
ViewTreeObserver!
Int
Int
Int
WindowId!
WindowInsetsController!
Int

This function is deprecated.

IBinder!
Int
Unit
Float
Float
Float
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
java-static View!
inflate(context: Context!, resource: Int, root: ViewGroup!)
Unit
invalidate(dirty: Rect!)

This function is deprecated.

Unit
Unit
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean

This function is deprecated.

Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
View!
keyboardNavigationClusterSearch(currentCluster: View!, direction: Int)
Unit
measure(widthMeasureSpec: Int, heightMeasureSpec: Int)
java-static IntArray<Int>!
mergeDrawableStates(baseState: IntArray!, additionalState: IntArray!)
Unit
Unit
Unit
Unit
WindowInsets!
Unit
Boolean
Boolean
Unit
Unit
InputConnection!
Unit
onCreateViewTranslationRequest(
    supportedFormats: IntArray!,
    requestsCollector: Consumer<ViewTranslationRequest!>!
)
Unit
onCreateVirtualViewTranslationRequests(
    virtualIds: LongArray!,
    supportedFormats: IntArray!,
    requestsCollector: Consumer<ViewTranslationRequest!>!
)
Unit
Boolean
Unit
onDraw(canvas: Canvas!)
Unit
Unit
Boolean
Unit
Unit
Unit
onFocusChanged(
    gainFocus: Boolean,
    direction: Int,
    previouslyFocusedRect: Rect!
)
Boolean
Unit
Boolean
Unit
Unit
Boolean
onKeyDown(keyCode: Int, event: KeyEvent!)
Boolean
onKeyLongPress(keyCode: Int, event: KeyEvent!)
Boolean
onKeyMultiple(keyCode: Int, repeatCount: Int, event: KeyEvent!)
Boolean
onKeyPreIme(keyCode: Int, event: KeyEvent!)
Boolean
onKeyShortcut(keyCode: Int, event: KeyEvent!)
Boolean
onKeyUp(keyCode: Int, event: KeyEvent!)
Unit
onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int)
Unit
onOverScrolled(
    scrollX: Int,
    scrollY: Int,
    clampedX: Boolean,
    clampedY: Boolean
)
Unit
Unit
Unit
Unit
Unit
Unit
Unit
ContentInfo!
Unit
Parcelable!
Unit
onScreenStateChanged(screenState: Int)
Unit
onScrollCaptureSearch(
    localVisibleRect: Rect!,
    windowOffset: Point!,
    targets: Consumer<ScrollCaptureTarget!>!
)
Unit
onScrollChanged(l: Int, t: Int, oldl: Int, oldt: Int)
Boolean
onSetAlpha(alpha: Int)
Unit
onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int)
Unit
Boolean
Unit
Unit
Unit
Unit
onVisibilityChanged(changedView: View!, visibility: Int)
Unit
onWindowFocusChanged(hasWindowFocus: Boolean)
Unit

This function is deprecated.

Unit
Boolean
overScrollBy(
    deltaX: Int,
    deltaY: Int,
    scrollX: Int,
    scrollY: Int,
    scrollRangeX: Int,
    scrollRangeY: Int,
    maxOverScrollX: Int,
    maxOverScrollY: Int,
    isTouchEvent: Boolean
)
Boolean
performAccessibilityAction(action: Int, arguments: Bundle!)
Boolean
Boolean
Boolean
performHapticFeedback(feedbackConstant: Int)
Boolean
ContentInfo!
Unit
playSoundEffect(soundConstant: Int)
Boolean
post(action: Runnable!)
Boolean
postDelayed(action: Runnable!, delayMillis: Long)
Unit
Unit
postInvalidateDelayed(delayMilliseconds: Long)
Unit
Unit
Unit
postOnAnimationDelayed(action: Runnable!, delayMillis: Long)
Unit
Unit
Boolean
Unit
Unit
Unit
Unit
Unit

This function is deprecated.

Boolean
Unit
Unit
Boolean
Unit
T!
<T : View?> requireViewById(id: Int)
Unit
java-static Int
resolveSize(size: Int, measureSpec: Int)
java-static Int
resolveSizeAndState(size: Int, measureSpec: Int, childMeasuredState: Int)
Unit
Unit
saveAttributeDataForStyleable(
    context: Context!,
    styleable: IntArray!,
    attrs: AttributeSet!,
    t: TypedArray!,
    defStyleAttr: Int,
    defStyleRes: Int
)
Unit
Unit
scheduleDrawable(who: Drawable!, what: Runnable!, when: Long)
Unit
scrollBy(x: Int, y: Int)
Unit
scrollTo(x: Int, y: Int)
Unit
Unit
Unit
setAccessibilityDataSensitive(accessibilityDataSensitive: Int)
Unit
Unit
Unit
Unit
setAccessibilityPaneTitle(accessibilityPaneTitle: CharSequence!)
Unit
Unit
Unit
setActivated(activated: Boolean)
Unit
setAllowClickWhenDisabled(clickableWhenDisabled: Boolean)
Unit
Unit
Unit
setAlpha(alpha: Float)
Unit
setAnimation(animation: Animation!)
Unit
Unit
Unit
setAutofillHints(autofillHints: Array<String!>!)
Unit
Unit
setBackground(background: Drawable!)
Unit
Unit

This function is deprecated.

Unit
Unit
Unit
Unit
Unit
setBottom(bottom: Int)
Unit
Unit
setClickable(clickable: Boolean)
Unit
setClipBounds(clipBounds: Rect!)
Unit
setClipToOutline(clipToOutline: Boolean)
Unit
Unit
setContentDescription(contentDescription: CharSequence!)
Unit
setContextClickable(contextClickable: Boolean)
Unit
setDefaultFocusHighlightEnabled(defaultFocusHighlightEnabled: Boolean)
Unit

This function is deprecated.

Unit

This function is deprecated.

Unit

This function is deprecated.

Unit
Unit
setElevation(elevation: Float)
Unit
setEnabled(enabled: Boolean)
Unit
Unit
Unit
setFitsSystemWindows(fitSystemWindows: Boolean)
Unit
setFocusable(focusable: Boolean)
Unit
setFocusableInTouchMode(focusableInTouchMode: Boolean)
Unit
setFocusedByDefault(isFocusedByDefault: Boolean)
Unit
Unit
setForeground(foreground: Drawable!)
Unit
Unit
Unit
Unit
Unit
setHandwritingBoundsOffsets(
    offsetLeft: Float,
    offsetTop: Float,
    offsetRight: Float,
    offsetBottom: Float
)
Unit
Unit
setHapticFeedbackEnabled(hapticFeedbackEnabled: Boolean)
Unit
setHasTransientState(hasTransientState: Boolean)
Unit
setHorizontalFadingEdgeEnabled(horizontalFadingEdgeEnabled: Boolean)
Unit
setHorizontalScrollBarEnabled(horizontalScrollBarEnabled: Boolean)
Unit
Unit
Unit
setHovered(hovered: Boolean)
Unit
setId(id: Int)
Unit
Unit
Unit
Unit
setIsCredential(isCredential: Boolean)
Unit
setIsHandwritingDelegate(isHandwritingDelegate: Boolean)
Unit
setKeepScreenOn(keepScreenOn: Boolean)
Unit
Unit
Unit
Unit
setLayerType(layerType: Int, paint: Paint!)
Unit
setLayoutDirection(layoutDirection: Int)
Unit
Unit
setLeft(left: Int)
Unit
setLeftTopRightBottom(left: Int, top: Int, right: Int, bottom: Int)
Unit
setLongClickable(longClickable: Boolean)
Unit
setMeasuredDimension(measuredWidth: Int, measuredHeight: Int)
Unit
setMinimumHeight(minHeight: Int)
Unit
setMinimumWidth(minWidth: Int)
Unit
Unit
setNextClusterForwardId(nextClusterForwardId: Int)
Unit
setNextFocusDownId(nextFocusDownId: Int)
Unit
setNextFocusForwardId(nextFocusForwardId: Int)
Unit
setNextFocusLeftId(nextFocusLeftId: Int)
Unit
setNextFocusRightId(nextFocusRightId: Int)
Unit
setNextFocusUpId(nextFocusUpId: Int)
Unit
Unit
Unit
Unit
Unit
Unit
Unit
Unit
Unit
Unit
Unit
Unit
setOnReceiveContentListener(
    mimeTypes: Array<String!>!,
    listener: OnReceiveContentListener!
)
Unit
Unit

This function is deprecated.

Unit
Unit
Unit
Unit
Unit
setOverScrollMode(overScrollMode: Int)
Unit
setPadding(left: Int, top: Int, right: Int, bottom: Int)
Unit
setPaddingRelative(start: Int, top: Int, end: Int, bottom: Int)
Unit
setPivotX(pivotX: Float)
Unit
setPivotY(pivotY: Float)
Unit
setPointerIcon(pointerIcon: PointerIcon!)
Unit
setPreferKeepClear(preferKeepClear: Boolean)
Unit
Unit
setPressed(pressed: Boolean)
Unit
setRenderEffect(renderEffect: RenderEffect!)
Unit
setRevealOnFocusHint(revealOnFocus: Boolean)
Unit
setRight(right: Int)
Unit
setRotation(rotation: Float)
Unit
setRotationX(rotationX: Float)
Unit
setRotationY(rotationY: Float)
Unit
Unit
Unit
setScaleX(scaleX: Float)
Unit
setScaleY(scaleY: Float)
Unit
setScreenReaderFocusable(screenReaderFocusable: Boolean)
Unit
setScrollBarDefaultDelayBeforeFade(
    scrollBarDefaultDelayBeforeFade: Int
)
Unit
setScrollBarFadeDuration(scrollBarFadeDuration: Int)
Unit
setScrollBarSize(scrollBarSize: Int)
Unit
Unit
Unit
Unit
setScrollContainer(isScrollContainer: Boolean)
Unit
setScrollIndicators(indicators: Int)
Unit
setScrollX(value: Int)
Unit
setScrollY(value: Int)
Unit
Unit
setSelected(selected: Boolean)
Unit
setSoundEffectsEnabled(soundEffectsEnabled: Boolean)
Unit
setStateDescription(stateDescription: CharSequence!)
Unit
Unit
Unit

This function is deprecated.

Unit
setTag(tag: Any!)
Unit
setTextAlignment(textAlignment: Int)
Unit
setTextDirection(textDirection: Int)
Unit
Unit
setTop(top: Int)
Unit
Unit
Unit
setTransitionName(transitionName: String!)
Unit
Unit
setTranslationX(translationX: Float)
Unit
setTranslationY(translationY: Float)
Unit
setTranslationZ(translationZ: Float)
Unit
setVerticalFadingEdgeEnabled(verticalFadingEdgeEnabled: Boolean)
Unit
setVerticalScrollBarEnabled(verticalScrollBarEnabled: Boolean)
Unit
Unit
Unit
Unit
Unit
setVisibility(visibility: Int)
Unit
setWillNotCacheDrawing(willNotCacheDrawing: Boolean)

This function is deprecated.

Unit
setWillNotDraw(willNotDraw: Boolean)
Unit
setX(x: Float)
Unit
setY(y: Float)
Unit
setZ(z: Float)
Boolean
ActionMode!
Unit
Boolean
startDrag(
    data: ClipData!,
    shadowBuilder: View.DragShadowBuilder!,
    myLocalState: Any!,
    flags: Int
)

This function is deprecated.

Boolean
startDragAndDrop(
    data: ClipData!,
    shadowBuilder: View.DragShadowBuilder!,
    myLocalState: Any!,
    flags: Int
)
Boolean
Unit
Unit
Unit
Unit
Unit
Boolean
Boolean

This function is deprecated.

Boolean
From android.view.ViewGroup
Unit
Unit
addExtraDataToAccessibilityNodeInfo(
    info: AccessibilityNodeInfo!,
    extraDataKey: String!,
    arguments: Bundle!
)
Unit
addFocusables(views: ArrayList<View!>!, direction: Int, focusableMode: Int)
Unit
addKeyboardNavigationClusters(
    views: (Mutable)Collection<View!>!,
    direction: Int
)
Boolean
Unit
Unit
addView(child: View!)
Boolean
addViewInLayout(child: View!, index: Int, params: ViewGroup.LayoutParams!)
Unit
attachLayoutAnimationParameters(
    child: View!,
    params: ViewGroup.LayoutParams!,
    index: Int,
    count: Int
)
Unit
attachViewToParent(child: View!, index: Int, params: ViewGroup.LayoutParams!)
Unit
Boolean
Boolean
Unit
Unit
childHasTransientStateChanged(
    child: View!,
    childHasTransientState: Boolean
)
Unit
Unit
Unit
Unit
Unit
debug(depth: Int)
Unit
Unit
Unit
detachViewsFromParent(start: Int, count: Int)
WindowInsets!
Boolean
Unit
Unit
dispatchCreateViewTranslationRequest(
    viewIds: (Mutable)Map<AutofillId!, LongArray!>!,
    supportedFormats: IntArray!,
    capability: TranslationCapability!,
    requests: (Mutable)List<ViewTranslationRequest!>!
)
Unit
Boolean
Unit
dispatchDraw(canvas: Canvas!)
Unit
Unit
Unit
Boolean
Boolean
Boolean
Boolean
Boolean
Boolean
Unit
Unit
Unit
Unit
Unit
Unit
dispatchScrollCaptureSearch(
    localVisibleRect: Rect!,
    windowOffset: Point!,
    targets: Consumer<ScrollCaptureTarget!>!
)
Unit
Unit
Unit
Unit
Unit

This function is deprecated.

Unit
Boolean
Boolean
Boolean
dispatchUnhandledMove(focused: View!, direction: Int)
Unit
dispatchVisibilityChanged(changedView: View!, visibility: Int)
Unit
Unit
Unit
WindowInsets!
dispatchWindowInsetsAnimationProgress(
    insets: WindowInsets!,
    runningAnimations: (Mutable)List<WindowInsetsAnimation!>!
)
WindowInsetsAnimation.Bounds!
Unit

This function is deprecated.

Unit
Boolean
drawChild(canvas: Canvas!, child: View!, drawingTime: Long)
Unit
Unit
View!
OnBackInvokedDispatcher!
Unit
findViewsWithText(
    outViews: ArrayList<View!>!,
    text: CharSequence!,
    flags: Int
)
View!
focusSearch(focused: View!, direction: Int)
Unit
Boolean
ViewGroup.LayoutParams!
ViewGroup.LayoutParams!
CharSequence!
View!
getChildAt(index: Int)
Int
Int
getChildDrawingOrder(childCount: Int, drawingPosition: Int)
java-static Int
getChildMeasureSpec(spec: Int, padding: Int, childDimension: Int)
Boolean
Boolean
getChildVisibleRect(child: View!, r: Rect!, offset: Point!)
Boolean
Boolean
Int
View!
LayoutAnimationController!
Animation.AnimationListener!
Int
LayoutTransition!
Int
ViewGroupOverlay!
Int

This function is deprecated.

Boolean
Boolean
Boolean
Int
indexOfChild(child: View!)
Unit
invalidateChild(child: View!, dirty: Rect!)

This function is deprecated.

ViewParent!
invalidateChildInParent(location: IntArray!, dirty: Rect!)

This function is deprecated.

Boolean

This function is deprecated.

Boolean

This function is deprecated.

Boolean
Boolean

This function is deprecated.

Boolean
Boolean
Boolean
Unit
Unit
layout(l: Int, t: Int, r: Int, b: Int)
Unit
measureChild(
    child: View!,
    parentWidthMeasureSpec: Int,
    parentHeightMeasureSpec: Int
)
Unit
measureChildWithMargins(
    child: View!,
    parentWidthMeasureSpec: Int,
    widthUsed: Int,
    parentHeightMeasureSpec: Int,
    heightUsed: Int
)
Unit
measureChildren(widthMeasureSpec: Int, heightMeasureSpec: Int)
Unit
notifySubtreeAccessibilityStateChanged(
    child: View!,
    source: View!,
    changeType: Int
)
Unit
offsetDescendantRectToMyCoords(descendant: View!, rect: Rect!)
Unit
offsetRectIntoDescendantCoords(descendant: View!, rect: Rect!)
IntArray<Int>!
Unit
onDescendantInvalidated(child: View!, target: View!)
Unit
Boolean
abstract Unit
onLayout(p: Boolean, p1: Int, p2: Int, p3: Int, p4: Int)
Boolean
onNestedPrePerformAccessibilityAction(
    target: View!,
    action: Int,
    args: Bundle!
)
Unit
onNestedPreScroll(target: View!, dx: Int, dy: Int, consumed: IntArray!)
Unit
onNestedScroll(
    target: View!,
    dxConsumed: Int,
    dyConsumed: Int,
    dxUnconsumed: Int,
    dyUnconsumed: Int
)
Unit
onNestedScrollAccepted(child: View!, target: View!, axes: Int)
Boolean
onRequestFocusInDescendants(direction: Int, previouslyFocusedRect: Rect!)
Boolean
PointerIcon!
onResolvePointerIcon(event: MotionEvent!, pointerIndex: Int)
Boolean
onStartNestedScroll(child: View!, target: View!, nestedScrollAxes: Int)
Unit
Unit
onViewAdded(child: View!)
Unit
Unit
Unit
Unit
Unit
removeDetachedView(child: View!, animate: Boolean)
Unit
removeView(view: View!)
Unit
removeViewAt(index: Int)
Unit
Unit
removeViews(start: Int, count: Int)
Unit
removeViewsInLayout(start: Int, count: Int)
Unit
requestChildFocus(child: View!, focused: View!)
Boolean
requestChildRectangleOnScreen(
    child: View!,
    rectangle: Rect!,
    immediate: Boolean
)
Unit
Boolean
requestFocus(direction: Int, previouslyFocusedRect: Rect!)
Boolean
Unit
Boolean
Unit
Unit
Unit

This function is deprecated.

Unit

This function is deprecated.

Unit

This function is deprecated.

Unit
Unit

This function is deprecated.

Unit
setClipChildren(clipChildren: Boolean)
Unit
setClipToPadding(clipToPadding: Boolean)
Unit
Unit
Unit
Unit
setLayoutMode(layoutMode: Int)
Unit
Unit
Unit
Unit
setPersistentDrawingCache(drawingCacheToKeep: Int)

This function is deprecated.

Unit
Unit
setTouchscreenBlocksFocus(touchscreenBlocksFocus: Boolean)
Unit
setTransitionGroup(isTransitionGroup: Boolean)
Unit
Boolean
Boolean
showContextMenuForChild(originalView: View!)
ActionMode!
startActionModeForChild(
    originalView: View!,
    callback: ActionMode.Callback!
)
Unit
Unit
Unit
Unit

Constants

DEBUG_SHOW_NONE

Added in 2.2.0
const val DEBUG_SHOW_NONE = 0: Int

DEBUG_SHOW_PATH

Added in 2.2.0
const val DEBUG_SHOW_PATH = 2: Int

DEBUG_SHOW_PROGRESS

Added in 2.2.0
const val DEBUG_SHOW_PROGRESS = 1: Int

TOUCH_UP_COMPLETE

Added in 2.2.0
const val TOUCH_UP_COMPLETE = 0: Int

TOUCH_UP_COMPLETE_TO_END

Added in 2.2.0
const val TOUCH_UP_COMPLETE_TO_END = 2: Int

TOUCH_UP_COMPLETE_TO_START

Added in 2.2.0
const val TOUCH_UP_COMPLETE_TO_START = 1: Int

TOUCH_UP_DECELERATE

Added in 2.2.0
const val TOUCH_UP_DECELERATE = 4: Int

TOUCH_UP_DECELERATE_AND_COMPLETE

Added in 2.2.0
const val TOUCH_UP_DECELERATE_AND_COMPLETE = 5: Int

TOUCH_UP_NEVER_TO_END

Added in 2.2.0
const val TOUCH_UP_NEVER_TO_END = 7: Int

TOUCH_UP_NEVER_TO_START

Added in 2.2.0
const val TOUCH_UP_NEVER_TO_START = 6: Int

TOUCH_UP_STOP

Added in 2.2.0
const val TOUCH_UP_STOP = 3: Int

VELOCITY_LAYOUT

Added in 2.2.0
const val VELOCITY_LAYOUT = 1: Int

VELOCITY_POST_LAYOUT

Added in 2.2.0
const val VELOCITY_POST_LAYOUT = 0: Int

VELOCITY_STATIC_LAYOUT

Added in 2.2.0
const val VELOCITY_STATIC_LAYOUT = 3: Int

VELOCITY_STATIC_POST_LAYOUT

Added in 2.2.0
const val VELOCITY_STATIC_POST_LAYOUT = 2: Int

Public constructors

MotionLayout

Added in 2.2.0
MotionLayout(context: Context)

MotionLayout

Added in 2.2.0
MotionLayout(context: Context, attrs: AttributeSet?)

MotionLayout

Added in 2.2.0
MotionLayout(context: Context, attrs: AttributeSet?, defStyleAttr: Int)

Public functions

addTransitionListener

Added in 2.2.0
fun addTransitionListener(listener: MotionLayout.TransitionListener!): Unit

adds a listener to be notified of drawer events.

Parameters
listener: MotionLayout.TransitionListener!

Listener to notify when drawer events occur

applyViewTransition

Added in 2.2.0
fun applyViewTransition(
    viewTransitionId: Int,
    motionController: MotionController!
): Boolean

Apply the view transitions keyFrames to the MotionController. Note ConstraintOverride is not used

Parameters
viewTransitionId: Int

the id of the view transition

motionController: MotionController!

the MotionController to apply the keyframes to

Returns
Boolean

true if it found and applied the viewTransition false otherwise

cloneConstraintSet

Added in 2.2.0
fun cloneConstraintSet(id: Int): ConstraintSet!

Creates a ConstraintSet based on an existing constraintSet. This makes a copy of the ConstraintSet.

Parameters
id: Int

The ide of the ConstraintSet

Returns
ConstraintSet!

the ConstraintSet

enableTransition

Added in 2.2.0
fun enableTransition(transitionID: Int, enable: Boolean): Unit

Disable the transition based on transitionID

Parameters
transitionID: Int
enable: Boolean

enableViewTransition

Added in 2.2.0
fun enableViewTransition(viewTransitionId: Int, enable: Boolean): Unit

Enable a ViewTransition ID.

Parameters
viewTransitionId: Int

id of ViewTransition

enable: Boolean

If false view transition cannot be executed.

fireTrigger

Added in 2.2.0
fun fireTrigger(triggerId: Int, positive: Boolean, progress: Float): Unit

This causes the callback onTransitionTrigger to be called

Parameters
triggerId: Int

The id set set with triggerID

positive: Boolean

for positive transition edge

progress: Float

the current progress

getConstraintSet

Added in 2.2.0
fun getConstraintSet(id: Int): ConstraintSet!

Get the ConstraintSet associated with an id This returns a link to the constraintSet But in most cases can be used. createConstraintSet makes a copy which is more expensive.

Parameters
id: Int

of the constraintSet

Returns
ConstraintSet!

ConstraintSet of MotionLayout

getConstraintSetIds

Added in 2.2.0
fun getConstraintSetIds(): @IdRes IntArray<Int>!

Get the id's of all constraintSets used by MotionLayout

Returns
@IdRes IntArray<Int>!

getCurrentState

Added in 2.2.0
fun getCurrentState(): Int

Return the current state id

Returns
Int

current state id

getDefinedTransitions

Added in 2.2.0
fun getDefinedTransitions(): ArrayList<MotionScene.Transition!>!

Get all Transitions known to the system.

getDesignTool

Added in 2.2.0
fun getDesignTool(): DesignTool!

getEndState

Added in 2.2.0
fun getEndState(): Int

Gets the state you are currently transition to.

Returns
Int

The State you are transitioning to.

getMatchingConstraintSetIds

fun getMatchingConstraintSetIds(types: Array<String!>!): IntArray<Int>!

Get the id's of all constraintSets with the matching types

Returns
IntArray<Int>!

getProgress

Added in 2.2.0
fun getProgress(): Float

Get current position during an animation.

Returns
Float

current position from 0.0 to 1.0 inclusive

getScene

Added in 2.2.0
fun getScene(): MotionScene!

Get the motion scene of the layout. Warning! This gives you direct access to the internal state of the MotionLayout making it easy corrupt the state.

Returns
MotionScene!

the motion scene

getStartState

Added in 2.2.0
fun getStartState(): Int

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

Returns
Int

State you are transitioning from.

getTargetPosition

Added in 2.2.0
fun getTargetPosition(): Float

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

Returns
Float

The target position you are moving to

getTransition

Added in 2.2.0
fun getTransition(id: Int): MotionScene.Transition!

This returns the internal Transition Structure

Parameters
id: Int

getTransitionState

Added in 2.2.0
fun getTransitionState(): Bundle!
Returns
Bundle!

bundle containing start and end state

getTransitionTimeMs

Added in 2.2.0
fun getTransitionTimeMs(): Long

Gets the time of the currently set animation.

Returns
Long

time in Milliseconds

getVelocity

Added in 2.2.0
fun getVelocity(): Float

Returns the last velocity used in the transition

Returns
Float

getViewVelocity

Added in 2.2.0
fun getViewVelocity(
    view: View!,
    posOnViewX: Float,
    posOnViewY: Float,
    returnVelocity: FloatArray!,
    type: Int
): Unit

Returns the last layout velocity used in the transition

Parameters
view: View!

The view

posOnViewX: Float

The x position on the view

posOnViewY: Float

The y position on the view

returnVelocity: FloatArray!

The velocity

type: Int

Velocity returned 0 = post layout, 1 = layout, 2 = static postlayout

isDelayedApplicationOfInitialState

Added in 2.2.0
fun isDelayedApplicationOfInitialState(): Boolean

Is initial state changes are applied during onAttachedToWindow or after.

Returns
Boolean

isInRotation

Added in 2.2.0
fun isInRotation(): Boolean

isInteractionEnabled

Added in 2.2.0
fun isInteractionEnabled(): Boolean

Determines whether MotionLayout's touch &click handling are enabled. An interaction enabled MotionLayout can respond to user input and initiate and control. MotionLayout interactions are enabled initially by default. MotionLayout touch &click handling may be enabled or disabled by calling its setInteractionEnabled method.

Returns
Boolean

true if MotionLayout's touch &click is enabled, false otherwise

isViewTransitionEnabled

Added in 2.2.0
fun isViewTransitionEnabled(viewTransitionId: Int): Boolean

Is transition id enabled or disabled

Parameters
viewTransitionId: Int

the ide of the transition

Returns
Boolean

true if enabled

jumpToState

Added in 2.2.0
fun jumpToState(id: Int): Unit

This jumps to a state It will be at that state after one repaint cycle If the current transition contains that state. It setsProgress 0 or 1 to that state. If not in the current transition itsl

Parameters
id: Int

state to set

loadLayoutDescription

fun loadLayoutDescription(motionScene: Int): Unit

This overrides ConstraintLayout and only accepts a MotionScene.

Parameters
motionScene: Int

The resource id, or 0 to reset the MotionScene.

onInterceptTouchEvent

fun onInterceptTouchEvent(event: MotionEvent!): Boolean

Intercepts the touch event to correctly handle touch region id handover

Parameters
event: MotionEvent!
Returns
Boolean

onNestedFling

fun onNestedFling(
    target: View,
    velocityX: Float,
    velocityY: Float,
    consumed: Boolean
): Boolean

onNestedPreFling

fun onNestedPreFling(target: View, velocityX: Float, velocityY: Float): Boolean

onNestedPreScroll

Added in 2.2.0
fun onNestedPreScroll(
    target: View,
    dx: Int,
    dy: Int,
    consumed: IntArray,
    type: Int
): Unit

React to a nested scroll in progress before the target view consumes a portion of the scroll.

When working with nested scrolling often the parent view may want an opportunity to consume the scroll before the nested scrolling child does. An example of this is a drawer that contains a scrollable list. The user will want to be able to scroll the list fully into view before the list itself begins scrolling.

onNestedPreScroll is called when a nested scrolling child invokes dispatchNestedPreScroll. The implementation should report how any pixels of the scroll reported by dx, dy were consumed in the consumed array. Index 0 corresponds to dx and index 1 corresponds to dy. This parameter will never be null. Initial values for consumed[0] and consumed[1] will always be 0.

Parameters
target: View

View that initiated the nested scroll

dx: Int

Horizontal scroll distance in pixels

dy: Int

Vertical scroll distance in pixels

consumed: IntArray

Output. The horizontal and vertical scroll distance consumed by this parent

type: Int

the type of input which cause this scroll event

onNestedScroll

Added in 2.2.0
fun onNestedScroll(
    target: View,
    dxConsumed: Int,
    dyConsumed: Int,
    dxUnconsumed: Int,
    dyUnconsumed: Int,
    type: Int
): Unit

React to a nested scroll in progress.

This method will be called when the ViewParent's current nested scrolling child view dispatches a nested scroll event. To receive calls to this method the ViewParent must have previously returned true for a call to onStartNestedScroll.

Both the consumed and unconsumed portions of the scroll distance are reported to the ViewParent. An implementation may choose to use the consumed portion to match or chase scroll position of multiple child elements, for example. The unconsumed portion may be used to allow continuous dragging of multiple scrolling or draggable elements, such as scrolling a list within a vertical drawer where the drawer begins dragging once the edge of inner scrolling content is reached.

Parameters
target: View

The descendent view controlling the nested scroll

dxConsumed: Int

Horizontal scroll distance in pixels already consumed by target

dyConsumed: Int

Vertical scroll distance in pixels already consumed by target

dxUnconsumed: Int

Horizontal scroll distance in pixels not consumed by target

dyUnconsumed: Int

Vertical scroll distance in pixels not consumed by target

type: Int

the type of input which cause this scroll event

onNestedScroll

Added in 2.2.0
fun onNestedScroll(
    target: View,
    dxConsumed: Int,
    dyConsumed: Int,
    dxUnconsumed: Int,
    dyUnconsumed: Int,
    type: Int,
    consumed: IntArray!
): Unit

React to a nested scroll in progress.

This method will be called when the ViewParent's current nested scrolling child view dispatches a nested scroll event. To receive calls to this method the ViewParent must have previously returned true for a call to onStartNestedScroll.

Both the consumed and unconsumed portions of the scroll distance are reported to the ViewParent. An implementation may choose to use the consumed portion to match or chase scroll position of multiple child elements, for example. The unconsumed portion may be used to allow continuous dragging of multiple scrolling or draggable elements, such as scrolling a list within a vertical drawer where the drawer begins dragging once the edge of inner scrolling content is reached.

This method is called when a nested scrolling child invokes dispatchNestedScroll} or one of methods it overloads.

An implementation must report how many pixels of the the x and y scroll distances were consumed by this nested scrolling parent by adding the consumed distances to the consumed parameter. If this View also implements NestedScrollingChild3, consumed should also be passed up to it's nested scrolling parent so that the parent may also add any scroll distance it consumes. Index 0 corresponds to dx and index 1 corresponds to dy.

Parameters
target: View

The descendant view controlling the nested scroll

dxConsumed: Int

Horizontal scroll distance in pixels already consumed by target

dyConsumed: Int

Vertical scroll distance in pixels already consumed by target

dxUnconsumed: Int

Horizontal scroll distance in pixels not consumed by target

dyUnconsumed: Int

Vertical scroll distance in pixels not consumed by target

type: Int

the type of input which cause this scroll event

consumed: IntArray!

Output. Upon this method returning, will contain the scroll distances consumed by this nested scrolling parent and the scroll distances consumed by any other parent up the view hierarchy

onNestedScrollAccepted

Added in 2.2.0
fun onNestedScrollAccepted(child: View, target: View, axes: Int, type: Int): Unit

React to the successful claiming of a nested scroll operation.

This method will be called after onStartNestedScroll returns true. It offers an opportunity for the view and its superclasses to perform initial configuration for the nested scroll. Implementations of this method should always call their superclass's implementation of this method if one is present.

Parameters
child: View

Direct child of this ViewParent containing target

target: View

View that initiated the nested scroll

axes: Int

Flags consisting of SCROLL_AXIS_HORIZONTAL, SCROLL_AXIS_VERTICAL or both

type: Int

the type of input which cause this scroll event

onRtlPropertiesChanged

fun onRtlPropertiesChanged(layoutDirection: Int): Unit

onStartNestedScroll

Added in 2.2.0
fun onStartNestedScroll(child: View, target: View, axes: Int, type: Int): Boolean

React to a descendant view initiating a nestable scroll operation, claiming the nested scroll operation if appropriate.

This method will be called in response to a descendant view invoking startNestedScroll. Each parent up the view hierarchy will be given an opportunity to respond and claim the nested scrolling operation by returning true.

This method may be overridden by ViewParent implementations to indicate when the view is willing to support a nested scrolling operation that is about to begin. If it returns true, this ViewParent will become the target view's nested scrolling parent for the duration of the scroll operation in progress. When the nested scroll is finished this ViewParent will receive a call to onStopNestedScroll.

Parameters
child: View

Direct child of this ViewParent containing target

target: View

View that initiated the nested scroll

axes: Int

Flags consisting of SCROLL_AXIS_HORIZONTAL, SCROLL_AXIS_VERTICAL or both

type: Int

the type of input which cause this scroll event

Returns
Boolean

true if this ViewParent accepts the nested scroll operation

onStopNestedScroll

Added in 2.2.0
fun onStopNestedScroll(target: View, type: Int): Unit

React to a nested scroll operation ending.

Perform cleanup after a nested scrolling operation. This method will be called when a nested scroll stops, for example when a nested touch scroll ends with a ACTION_UP or ACTION_CANCEL event. Implementations of this method should always call their superclass's implementation of this method if one is present.

Parameters
target: View

View that initiated the nested scroll

type: Int

the type of input which cause this scroll event

onTouchEvent

fun onTouchEvent(event: MotionEvent!): Boolean

onViewAdded

fun onViewAdded(view: View!): Unit

onViewRemoved

fun onViewRemoved(view: View!): Unit

rebuildMotion

Added in 2.2.0
Deprecated in 2.2.0
fun rebuildMotion(): Unit

rebuild the motion Layouts

rebuildScene

Added in 2.2.0
fun rebuildScene(): Unit

rebuild the motion Layouts

removeTransitionListener

Added in 2.2.0
fun removeTransitionListener(listener: MotionLayout.TransitionListener!): Boolean

adds a listener to be notified of drawer events.

Parameters
listener: MotionLayout.TransitionListener!

Listener to notify when drawer events occur

Returns
Boolean

true if it contained the specified listener

requestLayout

fun requestLayout(): Unit

rotateTo

Added in 2.2.0
fun rotateTo(id: Int, duration: Int): Unit

Rotate the layout based on the angle to a ConstraintSet

Parameters
id: Int

constraintSet

duration: Int

time to take to rotate

scheduleTransitionTo

Added in 2.2.0
fun scheduleTransitionTo(id: Int): Unit

on completing the current transition, transition to this state.

Parameters
id: Int

setDebugMode

Added in 2.2.0
fun setDebugMode(debugMode: Int): Unit

Display the debugging information such as paths information

Parameters
debugMode: Int

integer representing various debug modes

setDelayedApplicationOfInitialState

Added in 2.2.0
fun setDelayedApplicationOfInitialState(delayedApply: Boolean): Unit

Initial state changes are applied during onAttachedToWindow unless this is set to true.

Parameters
delayedApply: Boolean

setInteractionEnabled

Added in 2.2.0
fun setInteractionEnabled(enabled: Boolean): Unit

Enables (or disables) MotionLayout's onClick and onSwipe handling.

Parameters
enabled: Boolean

If true, touch &click is enabled; otherwise it is disabled

setInterpolatedProgress

Added in 2.2.0
fun setInterpolatedProgress(pos: Float): Unit

Set the transition position between 0 an 1

Parameters
pos: Float

setOnHide

Added in 2.2.0
fun setOnHide(progress: Float): Unit

Notify OnHide motion helpers

Parameters
progress: Float

setOnShow

Added in 2.2.0
fun setOnShow(progress: Float): Unit

Notify OnShow motion helpers

Parameters
progress: Float

setProgress

Added in 2.2.0
fun setProgress(pos: Float): Unit

Set the transition position between 0 an 1

Parameters
pos: Float

the position in the transition from 0...1

setProgress

Added in 2.2.0
fun setProgress(pos: Float, velocity: Float): Unit

Set the transition position between 0 an 1

Parameters
pos: Float
velocity: Float

setScene

Added in 2.2.0
fun setScene(scene: MotionScene!): Unit

Sets a motion scene to the layout. Subsequent calls to it will override the previous scene.

setState

fun setState(id: Int, screenWidth: Int, screenHeight: Int): Unit

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

Parameters
id: Int

set the state width and height

screenWidth: Int
screenHeight: Int

setTransition

Added in 2.2.0
fun setTransition(transitionId: Int): Unit

Set a transition explicitly to a Transition that has an ID The transition must have been named with android:id=...

Parameters
transitionId: Int

the id to set

setTransition

Added in 2.2.0
fun setTransition(beginId: Int, endId: Int): Unit

Set a transition explicitly between two constraint sets

Parameters
beginId: Int

the id of the start constraint set

endId: Int

the id of the end constraint set

setTransitionDuration

Added in 2.2.0
fun setTransitionDuration(milliseconds: Int): Unit

Change the current Transition duration.

Parameters
milliseconds: Int

duration for transition to complete

setTransitionListener

Added in 2.2.0
fun setTransitionListener(listener: MotionLayout.TransitionListener!): Unit

Set a listener to be notified of drawer events.

Parameters
listener: MotionLayout.TransitionListener!

Listener to notify when drawer events occur

setTransitionState

Added in 2.2.0
fun setTransitionState(bundle: Bundle!): Unit

Set the transition state as a bundle

toString

fun toString(): String!

touchAnimateTo

Added in 2.2.0
fun touchAnimateTo(touchUpMode: Int, position: Float, currentVelocity: Float): Unit
Parameters
touchUpMode: Int

behavior on touch up, can be either:

  • TOUCH_UP_COMPLETE (default) : will complete the transition, picking up automatically a correct velocity to do so
  • TOUCH_UP_STOP : will allow stopping mid-transition
  • TOUCH_UP_DECELERATE : will slowly decay, possibly past the transition (i.e. it will do a hard stop if unmanaged)
  • TOUCH_UP_DECELERATE_AND_COMPLETE : will automatically pick between TOUCH_UP_COMPLETE and TOUCH_UP_DECELERATE
, TOUCH_UP_STOP (will allow stopping
position: Float

animate to given position

currentVelocity: Float

touchSpringTo

Added in 2.2.0
fun touchSpringTo(position: Float, currentVelocity: Float): Unit

Allows you to use trigger spring motion touch behaviour. You must have configured all the spring parameters in the Transition's OnSwipe

Parameters
position: Float

the position 0 - 1

currentVelocity: Float

the current velocity rate of change in position per second

transitionToEnd

Added in 2.2.0
fun transitionToEnd(): Unit

Animate to the ending position of the current transition. This will not work during on create as there is no transition Transitions are only set up during onAttach

transitionToEnd

Added in 2.2.0
fun transitionToEnd(onComplete: Runnable!): Unit

Animate to the ending position of the current transition. This will not work during on create as there is no transition Transitions are only set up during onAttach

Parameters
onComplete: Runnable!

callback when task is done

transitionToStart

Added in 2.2.0
fun transitionToStart(): Unit

Animate to the starting position of the current transition. This will not work during on create as there is no transition Transitions are only set up during onAttach

transitionToStart

Added in 2.2.0
fun transitionToStart(onComplete: Runnable!): Unit

Animate to the starting position of the current transition. This will not work during on create as there is no transition Transitions are only set up during onAttach

Parameters
onComplete: Runnable!

callback when task is done

transitionToState

Added in 2.2.0
fun transitionToState(id: Int): Unit

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

Parameters
id: Int

the state to transition to

transitionToState

Added in 2.2.0
fun transitionToState(id: Int, duration: Int): Unit

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

Parameters
id: Int

the state to transition to

duration: Int

time in ms. if 0 set by default or transition -1 by current

transitionToState

Added in 2.2.0
fun transitionToState(id: Int, screenWidth: Int, screenHeight: Int): Unit

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

Parameters
id: Int

the state to transition

screenWidth: Int

the with of the motionLayout used to select the variant

screenHeight: Int

the height of the motionLayout used to select the variant

transitionToState

Added in 2.2.0
fun transitionToState(
    id: Int,
    screenWidth: Int,
    screenHeight: Int,
    duration: Int
): Unit

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

Parameters
id: Int

the state to transition

screenWidth: Int

the with of the motionLayout used to select the variant

screenHeight: Int

the height of the motionLayout used to select the variant

duration: Int

time in ms. if 0 set by default or transition -1 by current

updateState

Added in 2.2.0
fun updateState(): Unit

Not sure we want this

updateState

Added in 2.2.0
fun updateState(stateId: Int, set: ConstraintSet!): Unit

update a ConstraintSet under the id.

Parameters
stateId: Int

id of the ConstraintSet

set: ConstraintSet!

The constraintSet

updateStateAnimate

Added in 2.2.0
fun updateStateAnimate(stateId: Int, set: ConstraintSet!, duration: Int): Unit

Update a ConstraintSet but animate the change.

Parameters
stateId: Int

id of the ConstraintSet

set: ConstraintSet!

The constraintSet

duration: Int

The length of time to perform the animation

viewTransition

fun viewTransition(viewTransitionId: Int, view: Array<View!>!): Unit

Execute a ViewTransition. Transition will execute if its conditions are met and it is enabled

Parameters
viewTransitionId: Int
view: Array<View!>!

The views to apply to

Protected functions

dispatchDraw

protected fun dispatchDraw(canvas: Canvas!): Unit

Used to draw debugging graphics and to do post layout changes

Parameters
canvas: Canvas!

fireTransitionCompleted

Added in 2.2.0
protected fun fireTransitionCompleted(): Unit

This causes the callback TransitionCompleted to be called

getNanoTime

Added in 2.2.0
protected fun getNanoTime(): Long

Subclasses can override to define testClasses

Returns
Long

obtainVelocityTracker

Added in 2.2.0
protected fun obtainVelocityTracker(): MotionLayout.MotionTracker!

Subclasses can override to build test frameworks

onAttachedToWindow

protected fun onAttachedToWindow(): Unit

onLayout

protected fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int): Unit

onMeasure

protected fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int): Unit

parseLayoutDescription

protected fun parseLayoutDescription(id: Int): Unit

block ConstraintLayout from handling layout description

Parameters
id: Int

setTransition

Added in 2.2.0
protected fun setTransition(transition: MotionScene.Transition!): Unit

Public properties

IS_IN_EDIT_MODE

Added in 2.2.0
java-static val IS_IN_EDIT_MODEBoolean

Protected properties

mMeasureDuringTransition

Added in 2.2.0
protected val mMeasureDuringTransitionBoolean