2016-04-26 47 views
0

我有一個處理通過控制器的圖像請求SimpleDraweeView:後來壁畫:SimpleDraweeView總是正在重置

Postprocessor redMeshPostprocessor = new BasePostprocessor() { 
       @Override 
       public String getName() { 
        return "redMeshPostprocessor"; 
       } 

       @Override 
       public CloseableReference<Bitmap> process(
         Bitmap sourceBitmap, 
         PlatformBitmapFactory bitmapFactory) { 
        //custom processing on the bitmap and returning it 

       } 
      }; 

      ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(coverImage)) 
        .setPostprocessor(redMeshPostprocessor) 
        .build(); 

      PipelineDraweeController controller = (PipelineDraweeController) 
        Fresco.newDraweeControllerBuilder() 
          .setImageRequest(request) 
          .setOldController(iv_cover.getController()) 
          // other setters as you need 
          .build(); 
      iv_cover.setController(controller); 

然後,我想簡單地說,改變對SimpleDraweeView圖像:

iv_cover.setImageURI(Uri.parse(url)); 

問題是,當加載第二個圖像時,SimpleDraweeView顯示佔位符的地方有一秒鐘。如何避免這種情況?希望兩張圖像之間的過渡無縫且平滑。謝謝!

回答

1

你可以這樣做:

PipelineDraweeController controller = (PipelineDraweeController) 
       Fresco.newDraweeControllerBuilder() 
         .setLowResImageRequest(previousRequest) 
         .setImageRequest(newRequest) 
         .setOldController(iv_cover.getController())       
         .build(); 
     iv_cover.setController(controller); 

這應該給你你想要的行爲。