在xml中设置如下属性,就可以把图片变为圆角
fresco:roundedCornerRadius="5dp"
<com.facebook.drawee.view.SimpleDraweeView
fresco:roundedCornerRadius="5dp"
fresco:actualImageScaleType="focusCrop"
android:id="@+id/image_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
Uri uri = Uri.parse("http://i.imgur.com/DvpvklR.png");
SimpleDraweeView imageView = (SimpleDraweeView) findViewById(R.id.image_view);
imageView.setImageURI(uri);```

- 当然也可以设置底部不为圆角
<com.facebook.drawee.view.SimpleDraweeView
fresco:roundBottomLeft="false"
fresco:roundBottomRight="false"
fresco:roundedCornerRadius="500dp"
fresco:actualImageScaleType="focusCrop"
android:id="@+id/image_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />

- 如果你是用来做头像的,一般设置为圆圈图片
<com.facebook.drawee.view.SimpleDraweeView
fresco:roundAsCircle="true"
fresco:actualImageScaleType="focusCrop"
android:id="@+id/image_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />

- 还可以加个头盔
<com.facebook.drawee.view.SimpleDraweeView
fresco:roundAsCircle="true"
fresco:actualImageScaleType="focusCrop"
android:id="@+id/image_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
fresco:roundingBorderWidth="10dp"
fresco:roundingBorderColor="#ff0000" />```

网友评论