今天用到了CollapsingToolbarLayout,给背景添加一个模糊图片,原图是从ImageView中获取的Drawable对象;网上查阅了很多文章,,能快速模糊方式,是使用谷歌提供的RenderScript.
由于我的ImageView的图片是通过网络加载,顾只能通过getDrawable()拿到图片的Drawable对象,
使用网上提供的方法将Drawable转换成Bitmap,并高斯模糊设置到背景(略麻烦..),可结果竟然是这样…
而我想要的效果则是这样子的:
使用方法:
1:将Drawable转换成Bitmap
public static Bitmap drawableToBitmap(Drawable drawable) {
Bitmap bitmap = Bitmap.createBitmap(
drawable