Can I have a background and a drawable on an ImageView when using Picasso?

StackOverflow https://stackoverflow.com/questions/23629957

  •  21-07-2023
  •  | 
  •  

Вопрос

I'm using Picasso, and I need to have a background (fixed) on also ImageView and an image from an URL. (android:background and android:src on XML)

However it seems that whenever I set a URL to be downloaded onto my imageview using picasso, my background is lost.

Это было полезно?

Решение

Yes you can, Picasso only sets the image on the 'src', not the background..what might be happening is that your downloaded image is taking up all the space and you're not seeing the background. To quickly check if this is the case, try adding a android:padding="20dp" to the ImageView and you will see if this is the case.

In this case, you will ensure that you will always see the background behind, at least part of it..so it will help you debugging your case.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top