In my app I have a LinearLayout
which is transparent and it is attached to WindowManager
.I want to make that LinearLayout
Blur
so that everything behind the LinearLayout
will look blurred.I had gone through various sources from that I had got how to make a ImageView
blur and I had done that successfully using RenderScript Api
here is the code:
private static final float BLUR_RADIUS = 25f;
Bitmap outputBitmap = Bitmap.createBitmap(image);
final RenderScript renderScript = RenderScript.create(this);
Allocation tmpIn = Allocation.createFromBitmap(renderScript, image);
Allocation tmpOut = Allocation.createFromBitmap(renderScript, outputBitmap);
//Intrinsic Gausian blur filter
ScriptIntrinsicBlur theIntrinsic = ScriptIntrinsicBlur.create(renderScript, Element.U8_4(renderScript));
theIntrinsic.setRadius(BLUR_RADIUS);
theIntrinsic.setInput(tmpIn);
theIntrinsic.forEach(tmpOut);
tmpOut.copyTo(outputBitmap);
return outputBitmap;
}
and finally adding it with `ImageView`
ImageView imageView=(ImageView)findViewById(image-id);
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.nature);
Bitmap blurredBitmap = blur(bitmap);
imageView.setImageBitmap(blurredBitmap);
but sadly it blurs ImageView
only.Any solution for blurring a layout or modifiying the above code to use it with Layout.
Hi everyone I had got to know how to blur an ImageView
successfully but how can I blur an transparent LinearLayout.Is there any solution for this please help me