0

I want to be able to use external images in my android app,but i don't know how to deal with them,in the best case scenario they have a grey background:

enter image description here

How do i remove the grey background or any background to have a clean icon like the clip art that already exists in android studio(I already tried with apps and it's still drawing the background)

Dragos Ciupe
  • 109
  • 1
  • 7
  • 1
    PNG images are bitmap. Clip arts are vectors. You can try importing the .SVG vector version of this image instead to android studio and it will be converted to a vector xml – Robin Dec 02 '21 at 08:08
  • I tried this and it still has a background – Dragos Ciupe Dec 02 '21 at 08:10
  • 1
    Please make sure the image is .svg vector and not png and follow this to import. https://stackoverflow.com/a/67056210/7093155 I think the problem with the PNG you are using is that the background is not entirely transparent. If you are certain it is, then setting the background with ```android:background="@android:color/transparent" ```should work – Robin Dec 02 '21 at 08:20
  • I used an image wihout a background,converted to svg online and it worked,thanks,but what if it does have a background,what can i do,how can i remove it – Dragos Ciupe Dec 02 '21 at 08:39
  • You should post an answer instead of comment so i can accept your answer if you want. – Dragos Ciupe Dec 02 '21 at 08:40
  • Alright! For your other question, I think the only way to remove a background from png would be to edit on a design software and remove it. – Robin Dec 02 '21 at 08:50

1 Answers1

1

Please make sure the image is .svg vector and not png and follow this to import. stackoverflow.com/a/67056210/7093155

I think the problem with the png you are using is that the background is not entirely transparent. If you are certain it is, then setting the background with android:background="@android:color/transparent"

Robin
  • 904
  • 8
  • 16