How to Use android gif

How to Use GIF file in Android Studio

Hi Friends, In this article, we are going to learn how to Use GIF files in Android Studio step by step.

So let, start the Android Studio create a new project with empty Activity, and start the Use GIF file in Android Studio.

How to add GIF in Android Project?

Step 1. After creating a new project just open build.gradle(:app) file and add the below line in dependencies.

implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.3'

Then click on “sync now” to sync your Gradle.

Step 2. Past your GIF file inside the drawable directory and use it in step 3.

Step 3. Open your .xml file and paste below code inside this .xml

<pl.droidsonroids.gif.GifImageView
    android:id="@+id/gifImageView"
    android:layout_width="428dp"
    android:layout_height="224dp"
    android:layout_marginTop="232dp"
    android:src="@drawable/indian1"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintHorizontal_bias="0.563"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

Now Run your application, it will work perfectly.

Read - How to change the text to speech voice in android

Connect with me on:

Instagram: https://www.instagram.com/digitalshripal/
Linkedin: 
https://www.linkedin.com/in/shripal-singh
Twitter: 
https://twitter.com/ocptechnology
Facebook: 
https://www.facebook.com/ocptechnology
YouTube:
https://www.youtube.com/ocptechnology

One thought on “How to Use android gif

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top