您的位置:首页 > 其它

Fresco的简单使用

2016-09-18 17:11 155 查看
使用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()));
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Fresco 图片下载