Fresco Android GIF/WEBP动画无法播放

kis*_*idp 3 android fresco

我决定使用Fresco它,因为它提供了我的问题的解决方案:GIF和WEBP播放.

根据文件:http://frescolib.org/docs/animations.html

我可以使用这些代码自动播放动画:

   Uri uri;
   DraweeController controller = Fresco.newDraweeControllerBuilder()
       .setUri(uri)
       .setAutoPlayAnimations(true)
       . // other setters
       .build();
   mSimpleDraweeView.setController(controller);
Run Code Online (Sandbox Code Playgroud)

但是,当我使用代码时,它只显示静态图像.

为了玩GIF/WEBP,我还需要做任何其他步骤吗?或者我误解了文档对"动画"的使用?

编辑:

附加信息,在使用ControllerListener时,我发现onFinalImageSet()中的Animatable返回值为null.我不知道为什么.

我也试过运行这个示例项目,但.gif也没有动画:https://github.com/kaedea/fresco-sample-usage

我正在使用Nexus 5X测试btw(版本6.0.1)

Ale*_*nik 6

确保为动画添加Gradle依赖项:

dependencies {
  // If your app supports Android versions before Ice Cream Sandwich (API level 14)
  compile 'com.facebook.fresco:animated-base-support:1.2.0'

  // For animated GIF support
  compile 'com.facebook.fresco:animated-gif:1.2.0'

  // For WebP support, including animated WebP
  compile 'com.facebook.fresco:animated-webp:1.2.0'
  compile 'com.facebook.fresco:webpsupport:1.2.0'

  // For WebP support, without animations
  compile 'com.facebook.fresco:webpsupport:1.2.0'
}
Run Code Online (Sandbox Code Playgroud)