Android load image into imageview efficiently

前端 未结 1 349
傲寒
傲寒 2021-01-24 09:39

I have next problem: To avoid OutOfMemoryError i\'m loading my big images into ImageViews using Picasso in such way:

public static RequestCreator picasso(final C         


        
1条回答
  •  清酒与你
    2021-01-24 10:09

    Image loads with some delay (but i need to load it immideatly)

    you have to choose: (a) memory efficient delay or (b) instant but probable OOM. And I said that by experience, the app I have on the Play Store have a little delay while Picasso is processing it. It's just how it works.

    centerCrop() is not what i need in some cases.

    then you should load the image into() a Target. The target will receive the Drawable in the UI thread, from there you can set it up inside the ImageView (using the setScaleType) or as a background anyway you want. Maybe even using an InsetDrawable to adjust position.

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