How to animate .gif images in an android?

前端 未结 6 1693
一整个雨季
一整个雨季 2020-12-05 05:17

Here is the code for xml:



        
6条回答
  •  天涯浪人
    2020-12-05 05:58

    As far as I understand, your GIF image is not moving, so that's the native Android behaviour if you treat GIF like a static picture. For me the best solution (not to reinvent the wheel!) was the open-source library gitDrawable. Check their README, everything is very simple: add dependency to gradle and use(in XML or code). Example of usage in Java:

    GifDrawable gifFromResource = new GifDrawable( getResources(), R.drawable.anim );
    

提交回复
热议问题