如何将过滤器应用于imageView

时间:2015-11-06 09:53:27

标签: android xml android-studio

我有一个imageView,想要应用一个过滤器使它变得模糊,我使用android studio并且sdk的版本min是17,帮我实现这个任务

3 个答案:

答案 0 :(得分:0)

我认为您可以使用setAlpha()方法。

imageView.setAlpha(floatValue);

"的floatValue"范围从0到1.

为您的目的尝试低于1的值。

答案 1 :(得分:0)

了解/ Google“卷积滤镜”,这是一种根据周围像素值更改像素值的方法。因此除了模糊之外,您还可以进行图像锐化和线条查找。

How do I blur an image?

如果您的问题是如何模糊,那么您可以使用

imageview = (ImageView) itemView.findViewById(R.id.imageView);

BitmapDrawable drawable = (BitmapDrawable) imageview.getDrawable();
Bitmap bitmap = drawable.getBitmap();
Bitmap blurred = blurRenderScript(bitmap, radiusArr[position]);//second parametre is radius
imageview.setImageBitmap(blurred);

如需更多参考,请参阅此网址 https://github.com/Cutta/Simple-Image-Blur

答案 2 :(得分:0)

使用Picasso - Square

并应用Picasso Blur Transformation

这比试图重新发明轮子更容易。