在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);```
![Paste_Image.png](https://img.haomeiwen.com/i1503465/55edac1cbd3c3d4d.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
- 当然也可以设置底部不为圆角
<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" />
![Paste_Image.png](https://img.haomeiwen.com/i1503465/2007ed218a47745e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
- 如果你是用来做头像的,一般设置为圆圈图片
<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" />
![Paste_Image.png](https://img.haomeiwen.com/i1503465/f8423688fa5d28f6.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
- 还可以加个头盔
<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" />```
网友评论