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.
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
To learn in detail just follow our Youtube tutorial..
Android Related Videos
- Design a Modern Dashboard
- Material Design Login Screen with Shared Animations
- Create a Navigation Drawer Material Design in 2020
- Design Responsive Android App to fit all screen sizes
Related Articles that you might want to check out.
- Create a new project in android studio for beginners?
- How to create an Account on Fiverr and start earning?
- Create a Gig ob Fiverr and start selling specific services.
- How To Start Blogging and Make Money?
Our Projects Make Us Proud
- Building and Construction Company
- Chakwal.CO | Group Of Companies
- Online Buying and Selling Of Properties
My Latest Work