如何使用Fresco Library在Android Studio中模糊SimpleDraweeView

时间:2017-03-29 10:12:11

标签: blur fresco

我尝试了很多方法,但都失败了。有些人可以帮助我。非常感谢你。 我试过这个,但也失败了:https://github.com/s13524801/android-fresco-blur/blob/master/app/src/main/java/com/android/blur/MainActivity.java

2 个答案:

答案 0 :(得分:4)

ImageRequest request = ImageRequestBuilder.newBuilderWithSource(<your url>) .setPostprocessor(new IterativeBoxBlurPostProcessor(7)) .build();

然后 DraweeController controller = Fresco.newDraweeControllerBuilder() .setImageRequest(request) .setOldController(<your imageView>.getController()) .build(); imageRest.setController(controller);

答案 1 :(得分:0)

这是简单的解决方案:

Postprocessor postprocessor = new BlurPostprocessor(this,50);
        ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(Uri.parse(url))
                .setPostprocessor(postprocessor)
                .build();
        PipelineDraweeController controller = (PipelineDraweeController) Fresco.newDraweeControllerBuilder()
                .setImageRequest(imageRequest)
                .setOldController(background.getController())
                .build();
        background.setController(controller);