Android 如何使我的个人资料背景图像变暗模糊
我正在尝试使我的图像变得更暗模糊。我如何才能做到更暗的模糊 我正在使我的图像模糊,工作正常,但那一个不暗。我也在使用网络图像视图,我的图像是动态的来自服务api。我怎样才能使我的图像更暗更模糊 提前谢谢 我正在使用下面的代码Android 如何使我的个人资料背景图像变暗模糊,android,networkimageview,Android,Networkimageview,我正在尝试使我的图像变得更暗模糊。我如何才能做到更暗的模糊 我正在使我的图像模糊,工作正常,但那一个不暗。我也在使用网络图像视图,我的图像是动态的来自服务api。我怎样才能使我的图像更暗更模糊 提前谢谢 我正在使用下面的代码 public static Bitmap blur(Context ctx, Bitmap image) { int width = Math.round(image.getWidth() * BITMAP_SCALE); int heig
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项目
然后如何使其模糊?使其模糊,你说你这样做了,并获得图像视图和应用这个,如果您不知道如何模糊这个问题,您可以使用名为BlurView的同一个类。单击图像后还有一个疑问我想应用更暗的模糊,如果我禁用,我希望我的上一张图像不变暗。您怎么可能简单地说您从服务器获取图像,这样您就有了正确的url,因此只需将图像重置为视图,如果需要的话单击后,您可以再次应用模糊和暗效果,也可以检查给定的库,这可能有助于您快速解决问题。现在,我将在单击图像后执行此操作。如果我获得取消选择该图像,如何删除黑色此setColorFilter(0x76ffffff,PorterDuff.Mode.MULTIPLY);
Blurry.with(context)
.radius(10)
.sampling(8)
.color(Color.argb(66, 255, 255, 0))
.async()
.onto(rootView);