Orion's Studio.

安卓圆形图片两种方式

2018/03/26

Glide

1
2
3
Glide.with(this).load(url)
.apply(RequestOptions.circleCropTransform())
.into(mIvPic);

Fresco

xml文件

1
2
3
4
5
6
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/iv_pic"
android:layout_width="match_parent"
android:layout_height="match_parent"
fresco:roundAsCircle="true"
/>

Fragment代码

1
2
3
Uri uri = Uri.parse(url);
SimpleDraweeView ivPic = view.findViewById(R.id.iv_pic);
ivPic.setImageURI(uri);

url一定要带http哎,血的教训!

CATALOG
  1. 1. Glide
  2. 2. Fresco
  3. 3. url一定要带http哎,血的教训!