user7575308 user7575308 -4 years ago 73
Android Question

Fill in image background

I need to show something like this in an ImageView

Do you know a method to set an image in an ImageView like so?


ImageView imageView=(ImageView)findViewById(;

I need put in bitmap my picture and fuzzy picture in background.

this only sets one picture and I need put some fuzzy background

I know how put only one image in 100% quality.

But I don't know how set the background image to this picture.

I don't know how this "filter" name and I could not google for that.

Why the downvotes? I don't know how improve my question.

Answer Source


I recently came across Renderscript API.

//Set the radius of the Blur. Supported range 0 < radius <= 25
private static final float BLUR_RADIUS = 25f;

public Bitmap blur(Bitmap image) {
if (null == image) return null;

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));
return outputBitmap;

Use the above code snippet in the image view as shown below.

ImageView imageView = (ImageView) findViewById(;
Bitmap bitmap = BitmapFactory.decodeResource(getResources(),R.drawable.nature);
Bitmap blurredBitmap = blur(bitmap);

Dont forget to add below lines in build.gradle file

renderscriptTargetApi 18
renderscriptSupportModeEnabled true
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download