How to display .gif file in imageview?

Breed Hansen picture Breed Hansen · May 10, 2013 · Viewed 58.3k times · Source

My layout have lots of imageviews. I want to show .gif animated file in just one imageview. I tried Yash method (Adding gif image in an ImageView in android) but .gif file shown all layout. Other views dissappeared.

I want to show all.

Any idea?

Answer

Taslim Oseni picture Taslim Oseni · Nov 30, 2017

If you don't want to use Glide, just add this to your dependencies and create your unique 'gif'. Check for the latest version before use. ImageView:

implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.19'

Works very efficiently with minimal lines of code. An example is:

<pl.droidsonroids.gif.GifImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/dancer"
        android:src="@drawable/maddancer" />