android模糊透明效果怎么做,android – 如何使活动背景透明并模糊背景

how to blur the background?

您可以使用支持库中提供的RenderScript

public class BlurBuilder {

private static final float BITMAP_SCALE = 0.4f;

private static final float BLUR_RADIUS = 7.5f;

public static Bitmap blur(Context context,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(context);

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;

}

}

有关详细信息,请参阅this link

或者你可以使用Blurry

Does anyone has an idea where is the code in android to do that?

要获取应用程序屏幕的屏幕截图,请参阅this link

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值