Display Animated GIF

后端 未结 30 2413
无人及你
无人及你 2020-11-22 02:11

I want to display animated GIF images in my aplication. As I found out the hard way Android doesn\'t support animated GIF natively.

However it can display animations

30条回答
  •  萌比男神i
    2020-11-22 02:38

    I had a really hard time to have animated gif working in Android. I only had following two working:

    1. WebView
    2. Ion

    WebView works OK and really easy, but the problem is it makes the view loads slower and the app would be unresponsive for a second or so. I did not like that. So I have tried different approaches (DID NOT WORK):

    1. ImageViewEx is deprecated!
    2. picasso did not load animated gif
    3. android-gif-drawable looks great, but it caused some wired NDK issues in my project. It caused my local NDK library stop working, and I was not able to fix it

    I had some back and forth with Ion; Finally, I have it working, and it is really fast :-)

    Ion.with(imgView)
      .error(R.drawable.default_image)
      .animateGif(AnimateGifMode.ANIMATE)
      .load("file:///android_asset/animated.gif");
    

提交回复
热议问题