- Цвет фона значка запуска изображений Android Studio
- How to make the icon background of an Android app transparent?
- Android Studio Image Asset Launcher Icon Transparent Background Color
- Tried solutions:
- 4 Answers 4
- Icons for Android
- Android O and beyond
- Layer specs
- Foreground (scrolling parallax)
- Background (subtler parallax)
- Workaround for 7.1 or lower
- Update #1:
- Update #2:
- In Nexus 5X device (Android 8.1)
- In Nexus 5 emulator (Android 8.1)
- Opaque white background in some launcher apps
- Launcher3 source code
- Android Studio Image Asset Launcher Icon Background Color
- 12 Answers 12
Цвет фона значка запуска изображений Android Studio
У меня есть логотип .png для моего приложения, у которого нет фона, когда я добавляю его в студию Android в качестве объекта изображения, я вынужден иметь фон. Шестнадцатеричное поле не принимает 8-значные цветовые коды, только 6-значные. Есть ли способ сделать фон невидимым?
Чтобы сделать фон прозрачным, установите shape как None . Смотрите изображение ниже:
Для Android Studio 3.0 вы можете установить его на Legacy вкладке
Я использую, Android Studio 3.0.1 и если приведенный выше ответ не работает для вас, попробуйте изменить icon type на Legacy и выбрать Shape значение None по умолчанию Adaptive and Legacy .
Примечание. На некоторых устройствах установлена программа запуска с автоматическим добавлением белого фона в значок, это нормально.
У вас есть два пути:
1) В Background Layer> Scaling уменьшите размер до 1
а затем в Legacy> Legacy Icon установить Shape как None
2) в разделе «Фоновый слой»> «Масштабирование»> «Исходный объект» вы можете установить изображение как изображение размером 1×1 пиксель (или любого размера) transparent.png (вы уже создали).
а затем в Legacy> Legacy Icon установить Shape как None
вышеупомянутый подход не работал у меня на Android Studio 3.0. Он по-прежнему показывает фон. Я только что сделал пустой файл фона
Это сработало, за исключением слоев полного выпуска за обрез.
Это просто еще один обходной путь.
- Для «Слоя переднего плана» выберите «Тип актива» в качестве текста и удалите текст по умолчанию в текстовом поле.
- Для «Фонового слоя» выберите «Тип актива» в качестве изображения, а теперь выберите путь к изображению, которое вы хотите, в качестве значка.
И тебе хорошо идти.
Android Studio 3.5.3 Работает с этой конфигурацией.
Сначала создайте значок запуска (Adaptive and Legacy) из Image Asset:
Выберите image фоновый слой и измените его размер на 0% или 1%, а на вкладке «В устаревшей shape версии » установите значение none .
Затем удалите папку res/mipmap/ic_laucher_round в окне проекта, откройте AndroidManifest.xml и удалите атрибут android:roundIcon=»@mipmap/ic_launcher_round» из application элемента.
В конце концов удалите ic_launcher.xml из mipmap-anydpi-v26 .
Обратите внимание: некоторые устройства, такие как Nexus 5X (Android 8.1), автоматически добавляют белый фон и ничего не могут делать.
Вот шаги, которые я предпринял, чтобы сделать изображение прозрачным:
1- Я использовал онлайн-сайт, который делает изображение прозрачным, их много. Для меня я использую этот https://www241.lunapic.com/editor/?action=transparent, а иногда и http://www.online-image-editor.com/help/transparency
2- В Android Studio (я использую версию 3.1.3) откройте Image Asset из приложения> res (щелкните правой кнопкой мыши)> New> Image Asset.
3- В поле «Путь» выберите расположение прозрачного изображения, которое вы загрузили с веб-сайта, и установите другие параметры, как показано, затем «Далее», затем «Готово». Пять различных размеров изображения mdpi (48 × 48), hdpi (72 × 72), xhdpi (96 × 96), xxhdpi (144 × 144) и xxxhdpi (192 × 192) будут созданы в файле res / mipmap- плотность папок.
4- Если вам нужны размеры (размеры), отличные от указанных выше, вы можете использовать этот веб-сайт http://nsimage.brosteins.com/ для загрузки изображения PNG самого большого размера, которое будет использоваться в xxxhdpi. После загрузки вы можете загрузить zip-файл, содержащий изображения пяти разных размеров в папках res / drawable- density .
Используя android 3.0.1, я заметил это странное поведение (решение). Во-первых: в фоновом слое в source_asset измените asset_type с изображения на цвет, а затем снова измените его на изображение. во-вторых: включите обрезку при масштабировании, а затем измените размер до небольшого процента, и все будет работать отлично. PS: Если вы не сделали первый шаг, масштабирование не повлияет. и если у кого-то есть объяснение по этому поводу, пожалуйста, предоставьте. шаги
Источник
How to make the icon background of an Android app transparent?
A PNG image is to be used as the icon foreground, and the background should be completely transparent.
Using Android Studio > New Image Asset > Configure Image Asset dialog in the Asset Studio, virtually very combination of options for the background has been tried, including removing the file entirely from the path and deleting the background tags in ic_launcher.xml and ic_launcher_round.xml .
Removing the file from the path in this wizard and removing the tags from the XML files almost does the trick, but a faint black outline remains as the background (
alpha=20%). All other options for the Background Layer leave either a stark white or black background behind the foreground image when viewing the icon on the device’s launcher.
Many apps manage to have a foreground only on their icons, so it is possible. What am I doing wrong here?
Update: Thank you for the quick comments! I tried both the solutions provided as answers, same result. Screen capture is uploaded as suggested.
Updating just the Legacy icon in the wizard is not sufficient, as that only changes the Legacy icon format. The newer «Adaptive» icons are required as well. Even if the background is set to a completely transparent square png, Android Studio changes it to white. If the background file is removed entirely, the wizard allows completion, but then Android Studio uses a slightly opaque black background, as shown. With respect to the uploaded image, there should be nothing behind the foreground, completely gray to in this case without any visible circle.
Источник
Android Studio Image Asset Launcher Icon Transparent Background Color
You might be thinking this question is a duplicate of this one. But since then, Android Studio has been updated and the solution given there is not working anymore.
I am trying to set my app logo using image asset in android studio. This is because if I put my app logo directly in drawable or mipmap, then it causes many problems like: If it’s size is big then app crash occurs, if device running on oreo then logo will not showed and default ic_launcher is showing etc.
While trying to set my app’s logo using image asset, I am facing a problem: I can’t keep app logo’s background transparent.
I have a png logo made in photoshop and I want to set this as my app logo and I don’t want any background but android studio image asset doesn’t provide any option to remove background. I tried following solutions from google:
but none of these worked for me.
Tried solutions:
- By setting shape to none
- by Deleting ic_launcher_background file from it’s default location
- Tried in different devices
None of these works. please help me. Any help will be appreciated.
4 Answers 4
Android 8.0 Oreo (API level 26) introduced adaptive launcher icons, which consist of two layers: a foreground and a background. The material design guidelines state that the background layer must be opaque in Android O and beyond, as you can see at the bottom of the following citation. So, the adaptive launcher icon for Android 8.0 or higher must have opaque background color at least, if targetSdkVersion of your app is 26 or higher.
Icons for Android
Android O and beyond
Android O icons represent your app on a device’s Home and All Apps screens. The following guidelines describe how icons can receive unique visual treatments, animations, and behaviors.
Layer specs
Icons consist of two layers: a foreground and a background. Each layer can animate and receive treatments independently from the other layer.
Foreground (scrolling parallax)
- 108 x 108 dp
- 72dp masked section
- Transparency recommended (optional)
Background (subtler parallax)
- 108 X 108 dp
- 72dp masked section
- Must be opaque
Workaround for 7.1 or lower
Although launcher icons for 8.0 or higher must have opaque background color, the other legacy launcher icons for 7.1 or lower can revert to transparent background color, if you can omit round launcher icons from your app.
- First, create Launcher Icons (Adaptive and Legacy). It will create adaptive launcher icons and legacy launcher icons. All of them have opaque background color, at first.
- After that, create Launcher Icons (Legacy only). This will overwrite only the existing legacy launcher icons, as you can see in the second screenshot below. If you set the shape to none , they will have transparent background color.
- Delete folder res/mipmap/ic_laucher_round in the project window.
- Open AndroidManifest.xml and remove attribute android:roundIcon=»@mipmap/ic_launcher_round» from the application element.
In the left-side pane above, the following XML files define adaptive launcher icons for Android 8.0 or higher.
As seen in the right-side pane, they refer to the following drawable XML files.
Update #1:
In Android 8.0 or higher, the background color of launcher icons can be transparent, as shown in the Android 8.1 (Nexus 5X) screenshots. The sample app «NoAdaptive» is without any resource for the adaptive launcher icons in folder mipmap-anydpi-v26 , and the other app «Adaptive» has the resource.
Update #2:
Although the background color of launcher icon can be transparent in Android 8.0 or higher, it depends on user’s launcher app. Some launcher apps will convert your legacy icon to opaque adaptive icon.
In Nexus 5X device (Android 8.1)
The default launcher app is Google Now Launcher, according to its package name com.google.android.launcher . The background color can be transparent, as in the screenshots of Update #1.
In Nexus 5 emulator (Android 8.1)
The default launcher app is Pixel Launcher, according to its package name com.google.android.apps.nexuslauncher . The background color can be transparent in Recents screen, as in the screenshots below:
- opaque in Home screen
- transparent in Recents screen
- opaque in All Apps screen
Opaque white background in some launcher apps
These GMS apps are closed-source:
- com.google.android.launcher Google Now Launcher
- com.google.android.apps.nexuslauncher Pixel Launcher
In contrast, AOSP apps are open-source. Most launcher apps in Android are based on the source code of the following launcher apps:
- com.android.launcher
- Launcher (discontinued)
- Launcher2 (legacy)
- com.android.launcher2
- Launcher2 (original package name)
- com.android.launcher3
- Launcher3 (for Android 5.0 Lollipop or higher)
Launcher3 source code
In the git branch oreo-release of Launcher3, LauncherIcons.java has the method wrapToAdaptiveIconDrawable that wraps legacy launcher icon in adaptive launcher icon.
The flag FeatureFlags.LEGACY_ICON_TREATMENT is defined in FeatureFlags.java:
So, the background color of legacy launcher icon depends on this flag, and it can be opaque in some launcher apps such as Pixel Launcher.
Источник
Android Studio Image Asset Launcher Icon Background Color
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?
12 Answers 12
To make background transparent, set shape as None . See the image below:
For Android Studio 3.0, you can set it from Legacy Tab
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 .
Note: Some device has installed a launcher with automatically adding white background in icon, that’s normal.
You have two ways:
1) In Background Layer > Scaling, reduce the Resize to 1
and then in Legacy > Legacy Icon set Shape as None
2) in Background Layer > Scaling > Source Asset, you can set an image as a 1×1 pixel (or any size) transparent.png image (you’ve already created).
and then in Legacy > Legacy Icon set Shape as None
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
This worked except the full bleed layers
This is just another workaround.
- For the ‘Foreground Layer’, select ‘Asset type’ as text and delete the default text in the text field.
- 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.
Android Studio 3.5.3 It works with this configuration.
I Just put my view background (color code) as ClipArt or Image background, and it looks like transparent or no background where both have the same color as background.
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.
Источник