您的位置:首页 > 其它

Glide加载圆形、圆角等图片的用法

2017-06-23 09:37 288 查看
感谢大神,转载过来只是想自己保存使用   转载博客:http://blog.csdn.net/zhangphil //原图,是我博客的头像
ImageView image1 = (ImageView) findViewById(R.id.image1);
Glide.with(this).load(url).crossFade(1000).into(image1);

//原图 -> 圆图
ImageView image2 = (ImageView) findViewById(R.id.image2);
Glide.with(this).load(url).bitmapTransform(new CropCircleTransformation(this)).crossFade(1000).into(image2);

//原图的毛玻璃、高斯模糊效果
ImageView image3 = (ImageView) findViewById(R.id.image3);
Glide.with(this).load(url).bitmapTransform(new BlurTransformation(this, 25)).crossFade(1000).into(image3);

//原图基础上复合变换成圆图 +毛玻璃(高斯模糊)
ImageView image4 = (ImageView) findViewById(R.id.image4);
Glide.with(this).load(url).bitmapTransform(new BlurTransformation(this, 25), new CropCircleTransformation(this)).crossFade(1000).into(image4);

//原图处理成圆角,如果是四周都是圆角则是RoundedCornersTransformation.CornerType.ALL
ImageView image5 = (ImageView) findViewById(R.id.image5);
Glide.with(this).load(url).bitmapTransform(new RoundedCornersTransformation(this, 30, 0, RoundedCornersTransformation.CornerType.BOTTOM)).crossFade(1000).into(image5);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: