Using unicorn icons in android

Learn how to integrate lottie animations into your android app effortlessly.

1. Add Lottie to Your Project

Open your app-level build.gradle and add

copy
dependencies {
    implementation 'com.airbnb.android:lottie:6.0.0'
}

2. Place the JSON File

Place your your_animation.json in the app/src/main/res/raw/ folder.

3. Add Lottie View to Layout

copy
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/lottieIcon"
android:layout_width="150dp"
android:layout_height="150dp"
app:lottie_rawRes="@raw/your_animation"
app:lottie_autoPlay="true"
app:lottie_loop="true"
app:lottie_speed="1.0"
android:layout_gravity="center"/>

4. Control Animation

copy
val animationView = findViewById<LottieAnimationView>(R.id.lottieIcon)
animationView.setAnimation(R.raw.your_animation)
animationView.playAnimation()

5. Get Lottie Animations

Find free animations at Unicornicons.

We use cookies