【问题标题】:Fresco Android GIF/WEBP animation not playingFresco Android GIF/WEBP 动画不播放
【发布时间】:2016-12-17 23:34:43
【问题描述】:

我决定使用Fresco,因为它可以解决我的问题:GIFWEBP 播放。

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

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

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

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

为了播放 GIF/WEBP,我还需要执行其他步骤吗?还是我误解了文档对“动画”的使用?

编辑:

附加信息,在使用 ControllerListener 时,我发现 onFinalImageSet() 中的 Animatable 返回为空。我不确定为什么。

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

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

【问题讨论】:

  • 好的,问题是我没有添加支持 GIF 和 WebP 的模块

标签: android fresco


【解决方案1】:

确保添加Gradle dependencies for animations:

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'
}

【讨论】:

    猜你喜欢
    • 2017-02-12
    • 2021-06-19
    • 2023-03-28
    • 1970-01-01
    • 1970-01-01
    • 2012-08-24
    • 1970-01-01
    • 2019-10-28
    • 1970-01-01
    相关资源
    最近更新 更多