模糊后如何返回原始SimpleDraweeView

时间:2019-11-14 10:25:58

标签: java android imageview fresco

我有SimpleDraweeView(Fresco)。在模糊后如何返回原始图像?

模糊代码:

val blurController = Fresco.newDraweeControllerBuilder()
   .setImageRequest(
       ImageRequestBuilder.newBuilderWithSource(Uri.parse(imageUrl))
           .setPostprocessor(IterativeBoxBlurPostProcessor(7))
           .build()
   )
   .setOldController(image.controller)
   .build()

image.controller = blurController 

1 个答案:

答案 0 :(得分:0)

您可以像这样简单地为uri设置SimpleDraweeView

var offBlur=view.findViewById<ImageButton>(R.id.blur_off)
offBlur.setOnClickListener { 
    image.setImageURI(uri)  // this line
}

再次设置uri后,模糊效果将消失。