I'm new to android development and just created my first app. I selected my app icon, but don't know why the background of the image I saved, it's showing green whereas the original image doesn't have that. Is there any way that I can remove the green background.
The above is the image after selecting it in android studio.
How can I remove the green background?
Thanks in advance
CodePudding user response:
If you replaced the ic_launcher_foreground.xml
to change the icon, you also need to remove the third line in the ic_launcher.xml
and/or the ic_launcher_round.xml
below.
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
In any case, what you see is the ic_launcher_background.xml
in /res/drawable/
. Delete it, see what breaks and repair it by removing the call to the deleted xml.
CodePudding user response:
code structure
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/> // this is background color
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
color resource found in values/ic_launcher_background.xml
in your project dir
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#00FF00</color> // change color using(#) like : #000000(black)
</resources>
I mentioned black color code, you try to change color according to your icon.
or use transparent color like this
<color name="ic_launcher_background">#0000ffff</color> // transparent background color