Download image and resize to avoid OOM errors, Picasso fit() distorts image

前端 未结 1 934
抹茶落季
抹茶落季 2021-01-18 14:21

I am trying to show images in a full screen view and using the following code:

// Target to write the image to local storage.
Target target = new Target() {
         


        
1条回答
  •  一生所求
    2021-01-18 14:38

    You can combine fit() with centerCrop() or centerInside(), depending on how you want the image to fit your View:

    Picasso.with(context)
       .load(url)
       .fit()
       .centerCrop()
       .into(imgDisplay);
    
    Picasso.with(context)
       .load(url)
       .fit()
       .centerInside()
       .into(imgDisplay);
    

    0 讨论(0)
提交回复
热议问题