Add Lottie animation to android kotlin 2024

Create a raw directory and paste your lottie animation:

Download Animation from Lottie : https://lottiefiles.com/animations/cop-riding-on-a-motorcycle-g7eeU0h46n?from=search


The animation file will be .json







 Add Lottie Dependencies


implementation ("com.airbnb.android:lottie:3.4.0")




Add animaion to you xml file:
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/animationView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:lottie_rawRes="@raw/police"
app:lottie_autoPlay="true"
app:lottie_loop="true"/>



Done!

Documentation: https://lottiefiles.com/blog/working-with-lottie-animations/getting-started-with-lottie-animations-in-android-app

Comments