The previous project did not involve the display GIF picture function, also did not focus on the research, the recent project to use to display the GIF picture, therefore on the net a search, used after found the following several shortcomings.
1. Loading a large GIF image will cause an oom.
2. There is no preload and cache function, compared to memory consumption.
3. The function is relatively single, the GIF is displayed but the static picture cannot be displayed.
Finally, there was a powerful GIF loading framework that met all of the above flaws, supported preloading and caching, and supported the display of both static and GIF images. Here are some source code:
The XML layout is a ImageView
Call directly where needed
Glide.with (this). Load ("GIF address"). Centercrop (). into (iv_gif);//Not preloaded
Glide.with (this). Load ("GIF address"). Centercrop (). Placeholder (r.drawable.ic_launcher). Crossfade (). into (iv_gif);// There is a pre-loaded
JAR file
?
Android load GIF picture powerful framework (support preload, cache, also support to display static pictures, a line of code all done)