Adding an animated GIF into our application make it more live and beautiful. And implementing one properly is a little difficult task, well not anymore.
Now adding Animated fig to your application is easy as pie. There is a free library called “android-gif-drawable” by ‘koral’ to implement Animated GIF under MIT License.
How to implement ?
Step 1
Insert this dependency to build.gradle
file of your project.
dependencies { compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.3' }
Sync gradle
Step 2
Move to your XML File and add this GifImageView
<pl.droidsonroids.gif.GifImageView android:layout_width="match_parent" android:layout_height="match_parent" android:src="@drawable/src_anim" android:background="@drawable/bg_anim" />
Set the GIF image you wanted as source from drawable folder
That’s it your good to go.
For more reference visit the library by koral in github
https://github.com/koral–/android-gif-drawable