且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何显示的ImageView .gif文件?

更新时间:2023-10-22 13:58:04

把你的.gif文件到RES /原始文件夹,在您的片段或活动,比你可以设置GIF在ImageView的如

Put your .gif file into res/raw folder, in your fragment or activity and than you can set gif in imageview like

GifAnimationDrawable GIF;

GifAnimationDrawable gif;

try {
        gif = new 
         GifAnimationDrawable(getResources().openRawResource(R.raw.download));
        gif.setOneShot(false);
    } catch (NotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }

    ivGif.setImageDrawable(gif);
    gif.setVisible(true, true);
}

您可以从 HTTPS下载类://www.dropbox。 COM / S / rlyamlkqw02n0y9 / GifAnimationDrawable.java?DL = 0 https://www.dropbox.com/s/o6gxqfhem49khf5 /GifDe$c$cr.java?dl=0

如果上述任何环节不开放,你可以找到nelow链接类

If the any above link is not open you can find the class from nelow link

希望这会节省某人的时间很多,因为我从 http://***.com/a/11736861/3514144佩服>但我想说明它的ImageView

hope this will save someones time lot because i admire from http://***.com/a/11736861/3514144 but i want to show it in imageview

,以及如果链接不可用,你可以从上面的链接找到类。

As well if link is unavailable you can find class from above link.