使用Glide实现毛玻璃的效果
2017-10-17 10:33
148 查看
最近项目中需要用到一个接口中获取到的图片作为当前activity的背景图片,并且图片的效果需要是毛玻璃效果。怀着直接使用轮子的心情于是到github上查找轮子,终于找到了。
步骤1.引用库
步骤2. 使用Glide转换
转换可以有各种情况:
读者可在github上进行项目查看,链接:https://github.com/wasabeef/glide-transformations
另:如果你使用的是Picasso或Fresco也可以实现相同的效果,同样已有轮子
https://github.com/wasabeef/picasso-transformations
https://github.com/wasabeef/fresco-processors
步骤1.引用库
repositories { jcenter() } dependencies { compile 'jp.wasabeef:glide-transformations:3.0.1' // If you want to use the GPU Filters compile 'jp.co.cyberagent.android.gpuimage:gpuimage-library:1.4.1' }
步骤2. 使用Glide转换
Glide.with(this).load(R.drawable.demo) .apply(bitmapTransform(new BlurTransformation(25))) .into((ImageView) findViewById(R.id.image));
另外值得一提的是还可以进行组合转换如下:
MultiTransformation multi = new MultiTransformation( new BlurTransformation(25), new RoundedCornersTransformation(128, 0, RoundedCornersTransformation.CornerType.BOTTOM)))) Glide.with(this).load(R.drawable.demo) .apply(bitmapTransform(multi)) .into((ImageView) findViewById(R.id.image));
转换可以有各种情况:
Crop
CropTransformation,
CropCircleTransformation,
CropSquareTransformation,
RoundedCornersTransformation
Color
ColorFilterTransformation,
GrayscaleTransformation
Blur
BlurTransformation
Mask
MaskTransformation
读者可在github上进行项目查看,链接:https://github.com/wasabeef/glide-transformations
另:如果你使用的是Picasso或Fresco也可以实现相同的效果,同样已有轮子
https://github.com/wasabeef/picasso-transformations
https://github.com/wasabeef/fresco-processors
相关文章推荐
- Android使用glide实现毛玻璃效果
- 使用Glide快速实现毛玻璃效果
- 整理Glide方法使用含义(毛玻璃效果,实现圆角等)
- Android 毛玻璃效果实现(Glide)
- 使用Glide实现圆角效果
- 使用ASP.NET Atlas实现拖放(Drag & Drop)效果
- 使用GDI+实现光束效果
- [翻译]使用ASP.NET AJAX实现幻灯片效果
- 使用AjaxPro实现ajax效果
- 使用AjaxPro实现ajax效果
- [翻译]使用ASP.NET AJAX实现幻灯片效果
- 【Vegas原创】使用GreyBox组件实现ajax弹出式窗口效果
- 在.net中使用ajaxpro实现ajax效果的步骤
- Part9 使用蒙板、剪裁空间(应用:实现反射效果)
- 第九课,使用混合来实现半透明效果
- C# 中实现类似于WORD EXCEL 的动态缩放效果(客户后来说程序使用能产生乐趣)
- 使用SQL语句实现SPLIT效果的几种方法
- 使用MIDP1.0实现TiledLayer的效果,并实现简单的滚屏
- 使用XMLHTTP 获取服务器数据,实现无刷新效果
- .NET中使用datagrid实现的简单分页效果