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.
Because
whereas Android studio is very useful tool for developing powerful android
applications but there are some complexity provided by google in android studio
which make some things difficult to do. We can get things done with some types
of libraries which are provided over internet. A most common question arose by
many developers that
How to add Animated GIF in your android application?
?
Now adding Animated fig
to your android application in android studio is easy as pie. There is a free
library called “android-gif-drawable” by ‘koral’ to implement Animated GIF
under MIT License.
Please follow to these
two simple steps to add animated GIF to your application in your desired
activity or place.
Step 1:-
|
Insert this dependency to build.gradle . file of your project.
dependencies
{
compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.3'
}
|
then click on Sync gradle.
:-
Step 2:-
|
Now add your desired GIF file into Drawable folder.
Step 3:-
|
Now Move to your XML File and add following GifImageView
in xml file.
<pl.droidsonroids.gif.GifImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/src_anim"
android:background="@drawable/bg_anim"
/>
|
That’s it. you have done.
For more reference visit
the library by koral in github
0 Comments