Header Ads

test

How we can use lottie animation in androidx




How we can use Lottie animation .....
First download LottieAnimation from official website in json extension.



Create a assets folder --






Put this file in assets folder in android studio.









For lottie animation you will have to add dependency in  gradle module......

dependencies {
  implementation 'com.airbnb.android:lottie:3.3.1'
}


Add this file into your xml file----

<com.airbnb.lottie.LottieAnimationView
        android:id="@+id/animation_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#ff34"
        app:lottie_fileName="balloons.json"
        app:lottie_loop="true"
        app:lottie_autoPlay="true"
     />



How we can load Lottie animation programmatically

LottieAnimationViewanimationView=(LottieAnimationView)findViewByID(R.id.animation_view);
animationView.setAnimtion("balloons.json");
animationView.loop("true");
animationView.playAnimation();




No comments