A library that provides Android views and drawable types for displaying and controlling animated GIFs in apps. Rendering uses bundled native GIF decoding rather than WebView or the platform Movie class.
Overview
Android GIF Drawable is a library for showing animated GIF images inside Android applications. It supplies custom views and drawable implementations so GIF sources in layouts or code can animate instead of behaving like static images.
Frame decoding relies on GIFLib through JNI. The project positions this approach as more efficient than using WebView or Android’s Movie class for the same job.
You can declare GIFs in XML with GifImageView, GifImageButton, or GifTextView, or construct GifDrawable from resources, files, streams, and similar sources. GIF drawables implement Animatable and MediaPlayerControl, so playback can be started, stopped, seeked, and sped up. Metadata such as loop count, frame count, and comments is exposed through the API.
GifTextureView supports hardware-accelerated rendering where the device allows it. A MultiCallback helper lets one GifDrawable drive animation on several views at once. Consumers add the dependency through Gradle or Maven Central.
Key features
- GifImageView and GifImageButton XML support
- GifDrawable with stream and file sources
- Animatable and MediaPlayerControl playback APIs
- GIF metadata and memory introspection
- MultiCallback for shared drawables
- GifTextureView hardware-accelerated option
- Background-thread frame rendering
- Bundled ProGuard rules
Use cases
- Animated GIFs in Android UI layouts
- Programmatic GIF playback control
- Compound drawables with GIF assets
- MediaController-style GIF progress UI
- OpenGL texture GIF rendering