Search code examples
motiononbackpressedandroid-motionlayout

How to start animation of MotionLayout when something is happened?


I have got MotionLayout with motions of each view in it. All motions are working fine. I want to start motioning when onBackPressed() method is called or some button is clicked just like YouTube. Is it possible to do that?


Solution

  • MotionLayout has methods to drive the animation. things like motionLayout.transtionToState(...)