How to add gif to android studio?

Mujeeb ur rahman khan
2 min readOct 22, 2022

--

If you’re trying to add gif to your android app and facing difficulties, then this is right place to learn. Today I am going to demonstrate an easy way to add gif to your android app.

Following are the steps required:

1. Create new Project

Click on Create New Project.

It will lead you to new screen where you will find standard templet of Android Application.

Click on Empty Activity and Then Next.

It will lead you to final step, give name to your app and then Finish

your application will look like this.

2. Importing Dependencies

open build.gradle(Module)

Insert the following dependency to build.gradle file of your project

dependencies {
implementation ‘pl.droidsonroids.gif:android-gif-drawable:1.2.25’
}

and click on Sync Now.

3. Go back to your layout and paste the following code.

<pl.droidsonroids.gif.GifImageView
android:layout_width=”match_parent”
android:layout_height=”match_parent”
android:src=”@drawable/src_anim
android:background=”@drawable/bg_anim
/>

And you have successfully added gif to your android app

--

--

Mujeeb ur rahman khan
Mujeeb ur rahman khan

Written by Mujeeb ur rahman khan

I am final year IT engineering student from India. I have deep interest in Android development. on my way to become better developer

Responses (1)