Using unicorn icons in android

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

1. Add Rive Dependency

In your app-level build.gradle

copy
dependencies {
    implementation 'app.rive:rive-android:4.1.0'
}

2. Place Your .riv Filee

Put your .riv file in res/raw/ (create the folder if it doesn’t exist).

3. Use RiveAnimationView in XML

copy
<app.rive.runtime.kotlin.RiveAnimationView
android:id="@+id/riveView"
android:layout_width="150dp"
android:layout_height="150dp"
app:riveResource="@raw/your_animation"
app:riveArtboard="Main"
app:riveAnimation="Idle"
app:riveAutoplay="true" />

4. Control Animation

copy
val riveView = findViewById<RiveAnimationView>(R.id.riveView)
riveView.play("Idle")
riveView.pause()
riveView.setAnimation("Click")

5. Get Lottie Animations

Find free animations at Unicornicons.

We use cookies