0

I have a transparent image and when I add in my imageview it appears like this

SNAP

but I want to remove the white background of the image . I need only the boy in theimage to be show and remove the white background

is there any way I can do it ??? i ise everything but cant remove this background this my my code :

<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="110dp"
android:layout_height="150dp"
android:layout_margin="5dp"
app:cardCornerRadius="9dp"
app:cardElevation="10dp"
android:id="@+id/cardview"
android:background="@null" >

  <ImageView
        android:id="@+id/category_item"
        android:layout_width="110dp"
        android:layout_height="150dp"
        android:layout_gravity="center"
        android:background="@null" />

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
  • 1
    Possible duplicate of [show imageview in android studio without white background](https://stackoverflow.com/questions/57609754/show-imageview-in-android-studio-without-white-background) – Mike M. Aug 24 '19 at 16:46
  • Please don't repeat questions. Simply editing your original post with any new information you have, any new code you've tried, or an explanation of why any posted answers aren't working, will bump it to the top of the active queue. – Mike M. Aug 24 '19 at 16:46
  • It is working with android:background="@null" , just set a sorce android:src – Style-7 Aug 24 '19 at 18:26
  • Use .png or .svg + use src="your image" + delete this "android:background="@null" " from your code – POMAIIIUK Aug 24 '19 at 18:57

3 Answers3

0

Use paint.net to edit images.

enter image description here

Save the image and the white background is removed.

Jakob
  • 1,858
  • 2
  • 15
  • 26
0

Are you certain the background is truly transparent in the image? If it isn't you can try to edit it first by adding it to Photoshop and moving the black pixels to a new layer with a transparent background. Or you can try any of the .svg converter websites which can render simple images as .svg which you can download as a .png.

If that doesn't work there seems to be a similar question answered here: https://stackoverflow.com/a/6873336/9530685

flutterby
  • 46
  • 1
  • 6
0

I know this is pretty obvious but I said maybe you forgot

do you sure your image is PNG!!!?

for no background image you must use png format

A.Hosein
  • 182
  • 1
  • 10