使用fresco加载,可以自动进行图片的三级缓存,并对图片的一些样式进行设置
步骤:(1).在xml文件中添加: xmlns:fresco="http://schemas.android.com/apk/res-auto"
图片的视图样式:
<com.facebook.drawee.view.SimpleDraweeView
android:layout_marginLeft="7dp"
android:id="@+id/iv_classify"
fresco:placeholderImage="@mipmap/ic_launcher"
android:layout_width="100dp"
android:layout_height="100dp"
fresco:roundAsCircle="true"
></com.facebook.drawee.view.SimpleDraweeView>
(2)在java文件中
在调用布局之前初始化fresco
Fresco.initialize(getContext());//初始化Fresco使用默认配置
图片id.setImageURI(图片地址);
holder.iv_classify.setImageURI(Uri.parse(dataBeanList.get(i).getThumb()));
步骤:(1).在xml文件中添加: xmlns:fresco="http://schemas.android.com/apk/res-auto"
图片的视图样式:
<com.facebook.drawee.view.SimpleDraweeView
android:layout_marginLeft="7dp"
android:id="@+id/iv_classify"
fresco:placeholderImage="@mipmap/ic_launcher"
android:layout_width="100dp"
android:layout_height="100dp"
fresco:roundAsCircle="true"
></com.facebook.drawee.view.SimpleDraweeView>
(2)在java文件中
在调用布局之前初始化fresco
Fresco.initialize(getContext());//初始化Fresco使用默认配置
图片id.setImageURI(图片地址);
holder.iv_classify.setImageURI(Uri.parse(dataBeanList.get(i).getThumb()));