Android Studio Image Asset Launcher Icon Backgroun

2019-01-10 16:12发布

I have a .png logo for my app which doesn't have a background, when I add it to android studio as an Image Asset I am forced to have a background. The hex field doesn't accept 8 digit color codes, 6 digits only. Is there anyway to keep the background invisible?

5条回答
▲ chillily
2楼-- · 2019-01-10 16:36

You have two ways:

1) In Background Layer > Scaling, reduce the Resize to 1

enter image description here

and then in Legacy > Legacy Icon set Shape as None

enter image description here

2) in Background Layer > Scaling > Source Asset, you can set image as a 1x1 pixel transparent.png

enter image description here

and then in Legacy > Legacy Icon set Shape as None

enter image description here

查看更多
闹够了就滚
3楼-- · 2019-01-10 16:40

the above approach didn't work for me on Android Studio 3.0. It still shows the background. I just made an empty background file

<?xml version="1.0" encoding="utf-8"?>
<vector
android:height="108dp"
android:width="108dp"
android:viewportHeight="108"
android:viewportWidth="108"
xmlns:android="http://schemas.android.com/apk/res/android">
</vector>

This worked except the full bleed layers

查看更多
4楼-- · 2019-01-10 16:44

To make background transparent, set shape as None. See the image below:

enter image description here

EDIT:

For Android Studio 3.0, you can set it from Legacy Tab

enter image description here

查看更多
Emotional °昔
5楼-- · 2019-01-10 16:59

I'm using Android Studio 3.0.1 and if the above answer doesn't work for you, try to change the icon type into Legacy and select Shape to None, the default one is Adaptive and Legacy.

enter image description here

Note: Some device has installed a launcher with automatically adding white background in icon, that's normal.

查看更多
爷、活的狠高调
6楼-- · 2019-01-10 17:01

These are the steps I took to make an image transparent:

1- I used an online website which makes the image transparent, there are a lot of them. For me, I used this https://www241.lunapic.com/editor/?action=transparent

2- In Android Studio (I'm using version 3.1.3), open Image Asset from app > res (right click) > New > Image Asset Image Asset

3- In the Path, choose the location of the transparent image which you downloaded from the online website, and make the other options as shown, then Next, then Finish. The five different sizes of image mdpi(48×48), hdpi(72×72), xhdpi(96×96), xxhdpi(144×144), and xxxhdpi(192×192) will be created in the res/mipmap-density folders. Image Asset Configuration

4- If the image is needed for the drawable folders rather than the mipmap folders, then the needed five different sizes of image are mdpi(24×24), hdpi(36×36), xhdpi(48×48), xxhdpi(72×72), and xxxhdpi(96×96). In this case, we can use the image of size (96×96) located in mipmap-xhdpi folder created in the previous step and upload it to this website http://nsimage.brosteins.com/ and use the option called "Upload an Image". After uploading, we can download a zip file containing the five different sizes of image in the drawable-density folders. enter image description here

查看更多
登录 后发表回答