如何使我的个人资料背景图像更暗模糊

How to make my profile background image as darker blur

我正在尝试使我的图像更暗 blur.How 我可以做更暗的模糊吗?

我正在使我的图像模糊,工作正常但那个不是 darker.That 我正在使用网络图像视图,我的图像是来自服务 api 的动态图像。我怎样才能使我的图像更暗模糊。

提前致谢。

我正在使用下面的代码。

 public static Bitmap blur(Context ctx, Bitmap image) {
        int width = Math.round(image.getWidth() * BITMAP_SCALE);
        int height = Math.round(image.getHeight() * BITMAP_SCALE);

        Bitmap inputBitmap = Bitmap.createScaledBitmap(image, width, height, false);
        Bitmap outputBitmap = Bitmap.createBitmap(inputBitmap);

        RenderScript rs = RenderScript.create(ctx);
        ScriptIntrinsicBlur theIntrinsic = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs));
        Allocation tmpIn = Allocation.createFromBitmap(rs, inputBitmap);
        Allocation tmpOut = Allocation.createFromBitmap(rs, outputBitmap);
        theIntrinsic.setRadius(BLUR_RADIUS);
        theIntrinsic.setInput(tmpIn);
        theIntrinsic.forEach(tmpOut);
        tmpOut.copyTo(outputBitmap);

        return outputBitmap;
    }

你可以使用setColorFilter

imageView =(ImageView) findViewById(R.id.image_view) ;
imageView.getDrawable().setColorFilter(0x76ffffff, PorterDuff.Mode.MULTIPLY );

平均黑色 0xff555555

查看我的回答

或者您可能想使用这个 github 项目 https://github.com/wasabeef/Blurry

Blurry.with(context)
  .radius(10)
  .sampling(8)
  .color(Color.argb(66, 255, 255, 0))
  .async()
  .onto(rootView);