转载自:https://blog.csdn.net/longer__/article/details/67636456
第二种就是使用android-gif-drawable
demo的介绍和下载地址:
https://github.com/koral–/android-gif-drawable
这个更加方便,只需要两个步骤。
首先添加引用文件
不需要再下载.jar包,只需要的app的build.gradle里添加
dependencies {
compile ‘pl.droidsonroids.gif:android-gif-drawable:1.2.6’
}
其次在对应layout文件下添加自定义gif控件,在这个控件里直接添加gif动画文件。如下图代码所示。
”
<pl.droidsonroids.gif.GifImageView
android:id="@+id/gv_error"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@drawable/gif"/>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
”
这样就可以了,非常方便,多次 点击也不会出现OOM。