Facebook图片加载框架Fresco【3 圆角图片】

在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](http://upload-images.jianshu.io/upload_images/1503465-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](http://upload-images.jianshu.io/upload_images/1503465-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](http://upload-images.jianshu.io/upload_images/1503465-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" />```

Paste_Image.png
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容