GifAnimationDrawable(Gif 文件)不在 ListView 中播放

GifAnimationDrawable(Gif file) not playing in ListView

我要显示下载gif文件。

并使用 GifAnimationDrawable 处理。

正在仿真中运行。不在其他设备上。没有播放的 gif 图片。

无难点错误

public void showGifView(InputStream input){
                final GifAnimationDrawable drawable;
                try {
                    drawable = new GifAnimationDrawable(input, true);


                    act.runOnUiThread(new Runnable() {

                        @Override
                        public void run() {
                            // TODO Auto-generated method stub


                            view.setBackground(drawable);
                            AnimationDrawable frameAnimation = (AnimationDrawable) view.getBackground();
                            frameAnimation.start();

                        //view.setImageDrawable(drawable);//drawable.start();

                        }
                    });



                    input.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                    System.out.println("showGifView  //// " +  e);
                }

            }

为什么不用Glide来展示?

String filePath = "/storage/emulated/0/Pictures/amin1.gif";

Glide  
    .with( context )
    .load( Uri.fromFile( new File( filePath ) ) )
    .into( imageViewGif );

你也可以使用Glide by bumptech因为它们也支持加载gif图片。
你可以像这样使用它

Glide.with(this)
        .load(url)
        .into(myImageView);

要使用它,请将其添加到您的 gradle 文件

dependencies {
    compile 'com.github.bumptech.glide:glide:3.6.1'
    compile 'com.android.support:support-v4:19.1.0'
}