安卓加载gif图片

效果图:


1.引入Glide

implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'

 2.布局文件

<ImageView
    android:id="@+id/my_image_view"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
/>

3.使用:

ImageView imageView = (ImageView) findViewById(R.id.my_image_view);
Glide.with(this).load(R.drawable.timg).into(imageView);

4.加载网络图片:

添加网络权限html

<uses-permission android:name="android.permission.INTERNET" />
Glide.with(this).load(URL).into(imageView);

 

参考:java

https://www.jianshu.com/p/36092fe62637android

https://blog.csdn.net/Li_Qing_Xue/article/details/78919499git