github地址:https://github.com/vinc3m1/RoundedImageView
<com.makeramen.roundedimageview.RoundedImageView android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="20dp" android:id="@+id/ivtest" app:riv_oval="true" 是否显示椭圆,否则只有四个角有圆角 app:riv_corner_radius="200dp" app:riv_border_width="2dip" 边框宽度 app:riv_border_color="#333333" />
结合picasso一起使用:
ImageView ivTest = (ImageView) findViewById(R.id.ivtest); Transformation transformation = new RoundedTransformationBuilder() .borderColor(Color.BLACK) .borderWidthDp(3) .cornerRadiusDp(30) .oval(false) .build(); Picasso.with(this) .load("http://img.pconline.com.cn/images/upload/upc/tx/wallpaper/1402/12/c1/31189058_1392186616852.jpg") .transform(transformation) .into(ivTest);