Search code examples
android-motionlayout

Draw a point path using MotionLayout


Is there a way to draw in MotionLayout a view path without canvas.drawPath(path, p) ?

example1

example2


Solution

  • MotionLayout does not provide a drawing API. There are many solutions to this. The simplest no code solution is to Use Lottie (Medium on Lottie animations in MotionLayout) Put a LottieAnimationView in the MotionLayout and drive the progress.

    https://airbnb.io/lottie/#/android?id=core-classes The advantage is no code. The disadvantage is it would not be dynamic to the shape of the phone/language

    Building your own CustomView that is driven from MotionLayout is also very simple.