最近因为项目中需要用到gif动态图片,而android目前还不支持gif动态图片的加载,所以搜索了网上已有的第三方自定义控件,帮助实现加载gif图片。
第一步、引入依赖
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.6'
第二步、在layout文件使用
<pl.droidsonroids.gif.GifImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@mipmap/horse" />
动态gif图基本就可以显示