Limited offer — lifetime access:$75$60
Lottie · Android

Using Lottie icons in Android

Airbnb's Lottie library handles the rendering. Four steps: dependency, JSON file, XML view, done.

1

Add the Lottie dependency

Open your app-level build.gradle and add this to your dependencies block.

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

Drop the JSON file in res/raw

Download your icon from Unicorn Icons and place the .json file in app/src/main/res/raw/. Create the folder if it doesn't exist.

3

Add LottieAnimationView to your layout

Reference the animation with app:lottie_rawRes. The view autoplays and loops by default.

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

Control playback in Kotlin

Get the view by ID and call play, pause, or swap the animation file at runtime.

KOTLIN
val animationView = findViewById<LottieAnimationView>(R.id.lottieIcon)
animationView.setAnimation(R.raw.your_animation)
animationView.playAnimation()
// animationView.pauseAnimation()
// animationView.cancelAnimation()

Common questions

Where does the JSON file go?

In app/src/main/res/raw/. The file name without the extension becomes the resource ID — so star.json becomes @raw/star.

Can I load Lottie from a URL?

Yes. Use animationView.setAnimationFromUrl(url) instead. Add INTERNET permission to your manifest.

How do I loop a set number of times?

Set animationView.repeatCount = 3 — plays 4 times total. Use LottieDrawable.INFINITE for endless looping.

Get your animated icons

Browse icons ready for Android — free to download.

Browse icons