android Fresco gif图片不显示

2018-03-29 22:24:37

解决问题的方法

我是按照官方文档上写的来实现的代码如下。

SimpleDraweeView view = (SimpleDraweeView) findViewById(id);

Uri uri =  Uri.parse(imgUrl);
DraweeController controller = Fresco.newDraweeControllerBuilder()
        .setUri(uri)
        .setAutoPlayAnimations(true)
        .build();
view.setController(controller);

结果gif图片并没有显示,试了试普通图片并没有问题。那么问题来了,



最后百度搜索,发现高版本的Fresco   需要单独引入,gif模块。官方文档如下。


使用 Android Studio 或者其他 Gradle 构建的项目

编辑 build.gradle 文件:

1
2
3
4
dependencies {
  // 其他依赖
  compile 'com.facebook.fresco:fresco:0.12.0'}

下面的依赖需要根据需求添加:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
dependencies {
  // 在 API < 14 上的机器支持 WebP 时,需要添加
  compile 'com.facebook.fresco:animated-base-support:0.12.0'

  // 支持 GIF 动图,需要添加
  compile 'com.facebook.fresco:animated-gif:0.12.0'

  // 支持 WebP (静态图+动图),需要添加
  compile 'com.facebook.fresco:animated-webp:0.12.0'
  compile 'com.facebook.fresco:webpsupport:0.12.0'

  // 仅支持 WebP 静态图,需要添加
  compile 'com.facebook.fresco:webpsupport:0.12.0'}


  • 2020-12-08 17:13:57

    nvm卸载、安装node和npm

    1、node.js、nvm、 npm (1)在cmd中输入`where node`找到node长须所在位置进行删除 (2)确保计算机-环境变量删除相关引用 (3)在cmd中输入`node -v` ,得到以下结果,删除成功

  • 2020-12-08 17:23:36

    Window下完全卸载删除Nodejs

    1.从卸载程序卸载程序和功能。 2.重新启动(或者您可能会从任务管理器中杀死所有与节点相关的进程)。 3.寻找这些文件夹并删除它们(及其内容)(如果还有)。根据您安装的版本,UAC设置和CPU架构,这些可能或可能不存在:

  • 2020-12-09 08:48:45

    nodejs版本以及其对应的npm版本

    正在寻找某个大版本的最新版? Node.js 10.x Node.js 8.x Node.js 6.x Node.js 4.x Node.js 0.12.x Node.js 0.10.x 所有版本

  • 2020-12-12 17:27:54

    手把手教你 GitLab 的安装及使用

    GitLab:是一个基于Git实现的在线代码仓库托管软件,你可以用gitlab自己搭建一个类似于Github一样的系统,一般用于在企业、学校等内部网络搭建git私服。