Why do I need round Icon for my react native app? - android

I have created a rounded icon for my app with name ic_launcher.png. I read that I must have ic_launcher_round.png too.
Why do I need that as my icon is already rounded. Will removing that cause any problem ? Can I remove this line also from andrid_manifest.xml ?
android:roundIcon="#mipmap/ic_launcher_round"

After Android 8.0 (API level 26) you can use adaptive launcher icons.
To add an adaptive icon to an app using XML, begin by updating the android:icon attribute in your app manifest to specify a drawable resource. You can also define an icon drawable resource using the android:roundIcon attribute. You must only use the android:roundIcon attribute if you require a different icon asset for circular masks.
You can also define the background and foreground drawables as elements by enclosing them in and elements.
A simple way to generate a adaptive icons is in Android Studio.
Select App folder -> right click -> New -> Image Asset
Sample Image
Sample Icon
<?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>

Related

How to implement a themed monochrome icon for Material You

How would I implement a monochrome icon like other google apps so that it matches the dynamic colours picked by Material You?
Open your app icon and add the monochrome android:drawable attribute to the <adaptive-icon> element. For example, in res/mipmap-anydpi-v26/ic_launcher.xml:
<adaptive-icon >
<background android:drawable="..." />
<foreground android:drawable="..." />
<monochrome android:drawable="#drawable/mymonochromeicon" />
</adaptive-icon>
If your try this and it does not work then you need to remove the android:roundIcon element from your AndroidManifest.xml, or, alternatively, also add the <monochrome android:drawable="#drawable/mymonochromeicon"/> tag to your round icon.
Android Studio might give a warning saying Element monochrome is not allowed here however we can ignore this.

Android Image Asset is not drawn

I am trying to implement a splash screen for my application, following the usual method; defining a new theme inside the styles XML file that places a drawable as windowBackground and reverting to the main theme in the Activity's onCreate().
However, I am having problems when showing the logo I developed in Photoshop: I exported it as a 144x144 PNG file, created an Image Asset with it (replacing the standard ic_launcher drawable) but when I try to visualize it inside an XML file, this image is displayed instead
Screenshot
Any ideas? I've also tried to create a vector asset from the .psd but nothing is shown either...
https://romannurik.github.io/AndroidAssetStudio/
use this link to generate your icon. It will work.
Change the code and so on
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="#color/your_background"/>
<item android:drawable="#drawable/your_image">
</item>
</layer-list>

Android app icon for different build version

I'm trying to add launcher icon for my android application with adaptive icon features. The problem I'm facing that the icon works perfectly with android Oreo but it show android default android icon for pre Oreo devices.
How to set launcher icon according to different android versions?
Manifest code for icon :
android:icon="#mipmap/ic_launcher"
android:roundIcon="#drawable/ic_logo"
ic_launcher.xml
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="#mipmap/ic_background"/>
<foreground android:drawable="#mipmap/ic_foreground"/>
</adaptive-icon>
You can create adaptive icons in Android Studio like this
Right Click on app > New --> Image Asset
And this
You can choose your image, foreground layer and background layer and all

Dynamically change application theme depending on android:icon

I have integrated splash screen into my app from android manifest I gave it a newly made SplashTheme and whenever the onActivityCreated called I change it to the one that is needed. Now , in splash.xml file which you can see below:
<item>
<color android:color="#color/colorPrimary" />
</item>
<item>
<bitmap
android:gravity="center"
android:src="#mipmap/ic_launcher" />
</item>
I put my launcher ic_launcher in the center but when the device in which the app is installed uses round icons the splash screen still shows the "original" icon. I know because I put here ic_launcher instead of ic_launcher_round but I would like to make this part dynamic, to recognize if the devices uses round icons put ic_launcher_round and the opposite.
Here is the part of my AndroidManifest.xml:
Afaik, you cannot achieve the behavior you expect, simply because there does not exist an API, that would provide you whether current launcher uses round icon or a default icon.
Instead, you should construct your splash screen in a way, that is not dependent on the default launcher implementation of the device. Normally, you should have the same image regardless launcher uses round or normal icons.
Leave launcher icons aside and create a resource specifically for splash screen.

Create Launcher icon using Image Asset without background color or xml in Android Studio 3.0.1

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.
Why are we forced to have a background when creating an Image Asset? What's the reason behind this? How we are supposed to change the launcher_icon without having any background? I don't see any option to disable the background in Image Asset.
Alternatively, I use an empty background but this doesn't work in Full Bleed Layers:
<?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>
Or, just remove the background, but this will add a white background in your launcher_icon:
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Remove the background here and leave the foreground -->
<foreground android:drawable="#drawable/ic_launcher_foreground"/>
</adaptive-icon>
Or, change icon type into Legacy Only and set shape to none:
Still, there's a white background in the launcher icon when installed.
So how can I get a transparent background or none for that matter, for my Launcher icon using Image Asset?
It is not a problem of the icon you created with Android Studio, but it's a problem related to your specific device you're testing the application on.
In fact, in the Image Asset if you specify the Shape to None, you get a trasparent background.
To address your problem, please try to use a different Home theme, like the Nova Launcher; you can change the home theme in Settings - Home.

Categories

Resources