Android Studio Image Asset Launcher Icon Background Color

前端 未结 10 1433
无人及你
无人及你 2020-11-30 23:26

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 ac

相关标签:
10条回答
  • 2020-12-01 00:06

    I Just put my view background (color code) as ClipArt og Image background, and it looks like transparent or no background where both have the same color as background.

    0 讨论(0)
  • 2020-12-01 00:07

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

    EDIT:

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

    0 讨论(0)
  • 2020-12-01 00:08

    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 use this https://www241.lunapic.com/editor/?action=transparent and sometimes this http://www.online-image-editor.com/help/transparency

    2- In Android Studio (I'm using version 3.1.3), open Image Asset from app > res (right click) > New > 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.

    4- If you need sizes (dimensions) different from above, you can use this website http://nsimage.brosteins.com/ to upload your PNG image of biggest size that will be used in xxxhdpi. After uploading, you can download a zip file containing the five different sizes of image in the res/drawable-density folders.

    0 讨论(0)
  • 2020-12-01 00:10

    First, create a launcher icon (Adaptive and Legacy) from Image Asset:

    Select an image for background layer and resize it to 0% or 1% and In legacy tab set shape to none.

    Then, delete folder res/mipmap/ic_laucher_round in the project window and Open AndroidManifest.xml and remove attribute android:roundIcon="@mipmap/ic_launcher_round" from the application element.

    In the end, delete ic_launcher.xml from mipmap-anydpi-v26.

    Notice that: Some devices like Nexus 5X (Android 8.1) adding a white background automatically and can't do anything.

    0 讨论(0)
  • 2020-12-01 00:20

    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

    0 讨论(0)
  • 2020-12-01 00:20

    This is just another workaround.

    1. For the 'Foreground Layer', select 'Asset type' as text and delete the default text in the text field.

    1. For the 'Background Layer', select 'Asset type' as image and now choose the path of the image you want as an icon.

    And you are good to go.

    0 讨论(0)
提交回复
热议问题