• 引入Fresco


    这里告诉你如何在项目中引入 Fresco.

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

    Eclipse ADT

    下载 zip 文件.

    解压后,你会看到一个目录:frescolib,注意这个目录。

    1. 从菜单 “文件(File)”,选择导入(Import)
    2. 展开 Android, 选择 “Existing Android Code into Workspace”, 下一步。
    3. 浏览,选中刚才解压的的文件中的 frescolib 目录。
    4. 这5个项目应该被添加到工程: drawee, fbcore, fresco, imagepipeline, imagepipeline-base。请确认这5个项目一定是被选中的。点击完成。其他的项目参考之前 Gradle的额外依赖介绍。
    5. 右键,项目,选择属性,然后选择 Android。
    6. 点击右下角的 Add 按钮,选择 fresco,点击 OK,再点击 OK。

    现在,fresco 就导入到项目中了,你可以开始编译了。如果编译不通过,可以尝试清理资源,或者重启 Eclipse。

    如果你想在网络层使用 OkHttp,请看这里.

    如果 support-v4 包重复了,删掉 frescolib/imagepipeline/libs 下的即可。

    详细官方文档:https://www.fresco-cn.org/docs/index.html

    建议尽早使用 Android Studio。

  • 相关阅读:
    前端笔记-jquery
    git的使用
    前端笔记-bom
    微信小程序没找到构建npm或者没找到node_modules目录
    微信小程序判断 wx:if wx:else
    微信小程序提示云函数部署不成功
    cmd如何进入文件夹
    微信小程序view居中
    vue页面跳转兄弟组件传值
    vue全局变量apiurl
  • 原文地址:https://www.cnblogs.com/huolongluo/p/6094799.html
Copyright © 2020-2023  润新知