buildscript {
repositories {
mavenCentral()
}
}
allprojects {
repositories {
mavenCentral()
}
}
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.1'
<pl.droidsonroids.gif.GifImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/gif2" />
这种方式就比较简单了,直接看代码↓
implementation 'com.github.bumptech.glide:glide:4.7.1'
<ImageView
android:id="@+id/ivGif"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
RequestOptions options = new RequestOptions()
.diskCacheStrategy(DiskCacheStrategy.RESOURCE);
Glide.with(mContext).load(R.drawable.gif1).apply(options).into(ivGif);
以上就是加载gif图片的两种方式,我写的都是加载本地的gif,加载网络的gif图片应该也差不多一样,自己尝试吧…
代码比较简单,为了照顾初学者,需要的同学 戳这里 下载
Thanks all.
2017.5.30日 农历:五月初五 端午节
最后祝大家端午节快乐!!!大家记得吃粽子哦 :)
update on: 2018-09-23 修改依赖的 Glide 4.7.1
更多干货文章请关注我的微信公众号: