Native Mobile App Development With Java

Android Lottie animation example java

24-Sep-2024

Android Lottie example


1/  Add dependency of Lottie animation

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

2/  Add xml file on project

<TextView
android:layout_width="match_parent"
android:layout_height="40dp"
android:text="Lottie Animation"
android:gravity="center"
android:textSize="20dp"
android:textColor="@color/black"
android:textStyle="bold"
android:layout_marginBottom="200dp"
android:background="#03A9F4"
/>

<com.airbnb.lottie.LottieAnimationView
android:id="@+id/animationView"
android:layout_width="match_parent"
android:layout_height="300dp"
app:lottie_autoPlay="true"
app:lottie_loop="true"
android:layout_marginTop="-10dp"
app:lottie_rawRes="@raw/animation"
android:layout_gravity="center"
/>


3/  Manage Lottie animation from java.






Comments