# How to Add Snow to Your Android App

*By Jatin Jha · December 3, 2020*

'Tis the season... to make it snow in your Android apps!

---

Can’t believe it’s that time of year again. Christmas is just around the corner! In this post, we are going to show you how to add a snow falling to your Android app.

![](https://static.lottiefiles.com/blog_media/bgsqoSVCGc27fyxLD3QO21ZsFGXmzJZgB2NoeJCf.gif)

If you never used Lottie before, I’d recommend you check out [this article](https://lottiefiles.com/blog/working-with-lottie-animations/getting-started-with-lottie-animations-in-android-app).

# Adding Lottie to your project

From your project structure panel, select your projects build.gradle file and add the following lines inside your dependencies block:

```
// lottie lib
def lottieVersion = "3.4.4"
implementation "com.airbnb.android:lottie:$lottieVersion"
```

You can check for the latest version here → [https://github.com/airbnb/lottie-android](https://github.com/airbnb/lottie-android)

# Adding your SnowFall Overlay

In order to add the snowfall effect to your existing UI, we can start by adding a FrameLayout as a parent view with Base UI and Lottie Animation View added as a child view. Below is the code snippet for reference:

```
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:app="http://schemas.android.com/apk/res-auto">

    <androidx.constraintlayout.widget.ConstraintLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/black">
        
        <FrameLayout
            android:layout_width="0dp"
            android:layout_height="0dp"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintBottom_toBottomOf="parent">
            
            <androidx.appcompat.widget.AppCompatImageView
                android:id="@+id/ivIcon"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginStart="35dp"
                android:layout_marginEnd="35dp"
                app:srcCompat="@drawable/lf_logo"/>

            <com.airbnb.lottie.LottieAnimationView
                android:id="@+id/animationView"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:adjustViewBounds="true"
                android:scaleType="centerCrop"
                app:lottie_autoPlay="true"
                app:lottie_loop="true"
                app:lottie_rawRes="@raw/animation"/>
            
        </FrameLayout>

    </androidx.constraintlayout.widget.ConstraintLayout>

</layout>
```

This is how your UI should look like after adding the above code snippet.

![](https://static.lottiefiles.com/blog_media/BrxIErKTgygjpEdTaZzV7duzi6v43leNHPJnpK7q.png)

And now we need to add our Animation View inside our Base UI class where the Snowfall effect is needed to be shown in order to play the animation.

```
class SampleActivity : AppCompatActivity() {

    private lateinit var binding: ActivitySampleBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivitySampleBinding.inflate(layoutInflater)
        setContentView(binding.root)

        binding.animationView.playAnimation()

    }
}

```

In the above example, I have bundled the animation within the app by including them in your projects raw resources.

If your project does not have one, create it by going to File>New>Folder>Raw Resources Folder. If your animation contains images, you can bundle them all together in a .zip with your .json and follow the same procedure.

And voila! There you have it!

![](https://assets-blog.lottiefiles.dev/2021/04/ezgif.com-gif-maker--15--1.gif)

[Here is the full code](https://github.com/way2jatin/SnowFallSample) in case you missed something 😁.

Now your app is ready for the festive season. Merry Christmas!!!

Try it yourself with these Lottie snow animations

---

## Related Articles

- [Lottie/dotLottie vs. GIF: Choosing the Right Animation for You](/blog/working-with-lottie-animations/lottie-vs-gif)
- [Introducing Motion Copilot 2.0 in Lottie Creator](/blog/working-with-lottie-animations/introducing-motion-copilot-on-lottie-creator)
- [Lottie Creator 2.0: A Powerful Web-Based Lottie Animation Tool](/blog/working-with-lottie-animations/lottie-creator-a-powerful-web-based-lottie-animation-tool)
- [Introducing Motion System: One Workflow for Animation That Actually Ships](/blog/working-with-lottie-animations/introducing-motion-system-one-workflow-for-animation-that-actually-ships)