How to add a GIF Image in android studio example

by | Jan 5, 2020 | Android, Android UI/UX Tutorials, UI UX | 0 comments

In this tutorial we will add a gif image in android studio. You can use this gif simply as an image in your project and play with its attributes as per your requiremnts. You can use this gif image in android splash screen. Use it as a gif ImageView as an example.

How to add a Gif Image in android studio?

To add a gif image in android studio and use it as a gif image on splash screen in android. Follow the steps below and you are good to go.

buildscript {
    repositories {
        google()
        jcenter()
        mavenCentral()
    } dependencies {
        classpath 'com.android.tools.build:gradle:3.5.3'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
    }
}

Add a repository

Add mavenCentral() repository in first build.gradle file of project level. Same as shown in the below code.

Implement Dependency

Add this dependency inside your 2nd build.gradle file of app level inside the dependencies at the bottom of file.

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

Sync the Project

Once you added both the dependency and repository in your project. Click on the sync now link at the right top corner. Wait for few seconds until the project synced.

Use GIF file in the design

You can use the gif image in android splash screen by simply following the code mentioned below and play with its attribute as per your own requirements.

<pl.droidsonroids.gif.GifImageView
    android:id="@+id/gifImageView"
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    android:src="@drawable/travel"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

Q: How to add a gif image in android studio?

To add a GIF image in android studio or use it in Splash screen. You 1st have to add a mavenCentral() repository and then add a dependency in your build.gradle file

CODING with T

🚀 Supercharge your Flutter skills! Subscribe to my YouTube channel now for mind-blowing coding insights, expert tips, and exclusive content. Don’t miss out!

COURSES

Android firebase app - android app 2022 - firebase android app - bulls rent app - coding with t app - android app
android complete login signup product by taimoor sikander free for any type of android app
Flutter E Commerce App Modern and latest
Flutter Login App UI Source Code - Flutter Complete App - Flutter App Design - Flutter App 2023 - Complete Flutter App 2023
Learn flutter from scratch in 4 hours - Flutter Crash Course - Coding with T

Latest Tutorial

How to create a Custom Appbar in flutter. Custom Appbar Design. Flutter App Design
How to create a Custom Shape in Flutter. Flutter E Commerce app Design. Ecommerce app design Flutter. Flutter clippath tutorial
Bottom Navigation bar in Flutter. Flutter Material 3 bottom navigation bar. How to design background color of Flutter bottom navigation bar. Flutter ecommerce app design
Access Admin Panel, Premium Tutorials, Live Chat, 50% off Codes, and More on Patreon!
This is default text for notification bar