I added an animated gif image in an imageView. I am not able to view it as a gif image. No animation is there. It's appearing just as a still image. I would like to know how can i show it as a gif image.
In your build.gradle(Module:app), add android-gif-drawable
as a dependency by adding the following code:
allprojects {
repositories {
mavenCentral()
}
}
dependencies {
compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.+'
}
implementation
, so the above line might have to be changed to:
dependencies {
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.17'
}
Then sync your project. When synchronization ends, go to your layout file and add the following code:
<pl.droidsonroids.gif.GifImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/gif_file"
/>
And that's it, you can manage it with a simple ImageView.