我们一起学Android

Android显示gif以及使用第三方库的过程

2018-06-05  本文已影响19人  windmoonlight
  1. 依赖的gif项目

<u>https://github.com/Cutta/GifView.git</u>

<u>https://github.com/Cutta/GifView</u>

  1. 使用方式

  2. 下载https://github.com/Cutta/GifView/archive/1.1.tar.gz

  3. 解压

  4. 将GifView目录下的library拷贝到需要引用显示gif的工程目录下,如ZJMachineSNFaceAndroid,

image.png
  1. 在ZJMachineSNFaceAndroid工程中导入library

File->New->import module->

image.png
  1. ZJMachineSNFaceAndroid工程目录下的build.gradle内增内容有

allprojects内增加 maven { url "<u>https://jitpack.io</u>" }

image.png
  1. app内的build.gradle内增加内容有

dependencies 增加 compile project(':mylibrary')

repositories增加maven { url "<u>https://jitpack.io</u>" }

image.png
  1. 使用的界面中增加

xmlns:custom="http://schemas.android.com/apk/res-auto"

<com.cunoraz.gifview.library.GifView

android:id="@+id/gif1"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

custom:gif="@mipmap/dg" />

image.png
  1. 代码使用
image.png
上一篇下一篇

猜你喜欢

热点阅读