例:
加依赖:
dependencies { compile 'com.facebook.fresco:fresco:1.5.0' }
加权限:
<uses-permission android:name="android.permission.INTERNET"/>
适配器调用方法:
viewHolder.item_img.setImageURI(datas.get(position).getPicUrl()); //获取图片,Fresco
布局:
<com.facebook.drawee.view.SimpleDraweeView xmlns:fresco="http://schemas.android.com/tools" android:id="@+id/img_head" android:layout_width="match_parent" android:layout_height="match_parent" fresco:roundAsCircle="true" />
MyApplication类:
(<application/>在这个控件里加入属性:android:name=".MyApplication")
public class MyApplication extends Application { @Override public void onCreate() { super.onCreate(); //fresco的初始化 Fresco.initialize(this); } }