How to use Lottie Animation on Android?

Yağmur Erdoğan
2 min readOct 21, 2021

--

Hello everyone! 🌸 ️Have you heard of Lottie before? Lottie is a JSON-based animation file format. Yeah, Lottie is a format just like GIF or PNG. Developed by Airbnb and it’s an open source library!

The size of the Lottie file is quite small and it provides high quality appearance wherever it is used. It can use on web, mobile, desktop apps and some watches. You don’t have to modify anything to use Lottie on Android and iOS. Basically, Lottie is preferred for these abilities. Please check “Why Use Lottie?” for more information about this.

🦸🏻‍♀️ Let’s Use It!

Firstly, we should add implementation to our project. On this site we can find the latest version and copy the implementation. After that, don’t forget to Sync project.

🔮 Now we can select animation to use. Let’s check together.

Click for Animation!

Once you have decided which animation to choose, click on the animation and select the Lottie Json option. json file will be downloaded to your computer. If you want, you can change the speed and background color of the animation beforehand.

Open Android Studio and select “App” ->“New” -> “Folder” ->“Assets” to create “Assets” folder.

Copy your json file from downloads and paste it inside the Assets folder.

🔮Let’s configure activity_main.xml file;

As you can see, we should add “LottieAnimationView” and pass json name as fileName.

We made this sample with json file but we could use “Lottie Animation URL”.

🔮 Now we can run the app!

🦄 Sources

🪁 🛼 You can access source code from my GitHub! 🎈

--

--

Yağmur Erdoğan
Yağmur Erdoğan

Responses (1)