android-gif-drawable provides Android UI components and a Drawable that decode and play animated GIFs using bundled GIFLib via JNI.
Overview
android-gif-drawable lets Android apps show animated GIFs in standard views such as image views, buttons, and text views with compound drawables. GIF resources assigned through XML or code are recognized automatically and animated, while non-GIF drawables behave like ordinary widgets.
At the center is GifDrawable, constructed from assets, files, streams, or resources, with decoding handled through native GIFLib rather than WebView or the platform Movie class. The drawable implements Animatable and MediaPlayerControl for start, stop, seek, speed changes, and playback timing.
Rendering can run on a background thread so animation continues when not on screen, subject to visibility handling. The library exposes metadata helpers, recycling for memory management, multi-view callback support, and hardware-accelerated options through GifTextureView where API level requirements are met.
Projects integrate it as a Gradle or Maven dependency, with Proguard rules bundled for release builds.
Key features
- GifImageView and GifImageButton
- GifDrawable from multiple sources
- JNI GIFLib frame rendering
- Playback speed and seek control
- MediaPlayerControl integration
- GifTextureView hardware rendering
- MultiCallback for multiple views
- GIF metadata accessors
Use cases
- Animated GIFs in Android UIs
- Chat or feed sticker playback
- GIF backgrounds on buttons
- Compound drawables in TextViews
- Controlled GIF animation in lists