Adding a GIF to an ImageView
Easiest way to add an GIF (Graphics Interchange Format) images to a ImageView is using the Android GIF Drawable Library. You do not have to implement a custom view. Using this library is more efficient than using WebView or Movie classes.
1. First add the dependency to build.gradle if you are using Android Studio
dependencies { compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.3' }
or Maven dependency
<dependency> <groupid>pl.droidsonroids.gif</groupid> <artifactid>android-gif-drawable</artifactid> <version>1.0.6</version> </dependency>
2. Build the project (the dependency will be downloaded)
3. Place your GIF file in the drawable resource folder
4. Then add your gifview in a layout file
<pl.droidsonroids.gif.GifTextView android:id="@+id/gifview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/gif_file"/>
More details
mvnrepository
github
stackoverflow
glide is another library similar to android-gif-drawable