Can I set the colour of the Launcher Icon? - android

I am writing a very simple app as a starter and using a material design icon as the launcher icon. Is there a way I can set the colour of just the launcher icon like I can the size and shape?
Here is my code from AndroidManifest.xml
<application
android:allowBackup="true"
android:icon="#drawable/gasstation"
android:label="#string/app_name"
android:iconTint="#color/sysGreen"
android:roundIcon="#drawable/gasstation"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
The statement android:iconTint seems to be OK in that Android Studio has not flagged it as an error but it has no effect. The launcher icon is still the grey colour of the downloaded image resource.
Is this possible? Any help greatly appreciated.

If you retrieve the icon from a drawable, basically a small image you have in your resources, you cannot change the color.
What you can instead do is to use the tool Image Asset Studio, here is the link
As explained
In the Project window, select the Android view. Right-click the res
folder and select New > Image Asset.
then follow the guide..
Anyway from API version 21, you can tint drawables,
as explained in this post

Well ... I finally did it as follows.
right click on res>new image asset>clip art>pick the icon
you can set the foreground colour manually in the Configure Image Asset screen

Related

Android launcher icon only appears in the emulator

I'm trying to add a launcher icon to my android app. I have watched multiple tutorials online that explain how that works. I ended up doing it this way:
https://www.youtube.com/watch?v=DQ8HDL-X9rM
The laucher icon does appears in the android simulator but not on physical phones.
what I have tried to do:
clean the build in android studio
reset the icon the way it says in the tutorial
checked the reference in android manifest
checked if the icon was changed in the drawable and mipmap folders
that were the tips that showed up in a stackoverflow topic a couple years back.
I have been working on it for the passed week and I just can't get it to work.
This is my ic_launcher.xml
<?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"/>
<foreground android:drawable="#mipmap/ic_launcher"/>
</adaptive-icon>
And this is this are the lines in my AndroidManifest
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
<activity android:name="com.example.fragments.Product">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.MainActivity" />
</activity>
<activity android:name="com.example.MainActivity">
<intent-filter>
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
</application>
Also I checked all the mipmap folders and all my icons are in there with the correct names.
Does anyone know what I can do?
---update june 3---
Now its not even showing up on the emulator anymore...
I have tried and read all the topics online I really hope someone can spot what I do wrong
You can simple way to add icon for app
go to project
app->res->drawable->right click->new->image asset-> source asset
select image path and click to next button
RUN the app
another way

Issue displaying flutter app icon on certain versions of android

I have a flutter app in which I have generated app icons for under the android folder of the project with the image asset tool that comes with android studio. On certain versions of android however neither this icon or flutter's default icon displays which seems to tell me this isn't just an issue with the icons I've provided, I instead get the default green android as such:
The screenshots above have come from an android 5 emulator (albeit quite old now its still technically supported by flutter so I wanted to test this) and I get the same problems on a physical device running android 7, but the icon seems to appear fine on any versions above. Something else I have noticed is that no app name appears in the multitasking menu but I'm not sure if that is a completely unrelated issue.
If anyone could help me that would be great, as I can't figure out what other icons I need to place in the project as I thought I'd covered all options. Thanks.
Edit- This is the android manifest for my app:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="me.letalis.testapp">
<application
android:label="Test App"
android:icon="#mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="#style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="#style/NormalTheme"
/>
<!-- Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame. -->
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="#drawable/launch_background"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>
Res folder:
Follow these Steps to Change/Customize Launcher Logo in Android Studio,
*Expand the project root folder in the Project View
*Right Click on the app folder
*In the Context Menu go to New->Image Asset
*In the pop up that appears select the the new logo you would like to have(image/clip art/text).
*If you were selecting the image radio button (as is the default choice), if you clicked on the 3-buttons to show the path tree to locate your .png image file, most probably you might not be seeing it, so drag it from the Windows Explorer (if Windows) and drop it in the tree, and it will appear and ready for being selected.
**Don't forget to set new icon's location in manifest: replace drawable to minimap in android:icon –
..........Mipmap Solution:
As you can see this Snapshot, I set Mipmap for every version, you can follow this also,
You have to create an XML file for anydpi-v26
`<?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"/>
<foreground android:drawable="#mipmap/ic_launcher_foreground"/>
</adaptive-icon>`

How do I change the app icon in the 'Recents' Screen?

I know how to change the icon of my app, but when I look at the Recents Screen, the icon is the default one.
App icon (all good so far):
Icon in my Recents Screen:
This is the 'application' tag of my 'AndroidManifest.xml'
<application
android:name=".App"
android:allowBackup="true"
android:icon="#mipmap/iconout"
android:roundIcon="#mipmap/iconout"
android:logo="#mipmap/iconout"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
I've tried many solutions that I found on this platorm (that didn't work), like:
file->new->image asset->choose image..
install & unistall the app
build & clean project
delete all the default icons on my project
drag & drop my icon to drawable from mipmap folder
Any other possible solutions? Thank you in advance!
Ok I found the solution and decided to answer for anyone that will encounter the same problem in the future.
I fixed it by adding android:icon="#mipmap/iconout" in the main activity tag declaration in the AndroidManifest.xml, like so:
<activity
android:icon="#mipmap/iconout"
android:name=".MainActivity"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
And here's the final result:
Try to change the format of the icon to PNG. That works for me.
Or you could try the application on different devices to see if it's not a problem of the emulator/phone.

How to use one icon for the application and one for the activities?

I am building an Android app. In this app I have added a launcher icon (to be used as an app icon) but I also using another icon to be used in the actionbar on all activities. The activity icon got a transparent background color but the application icon is using a solid color background.
The problem is that when I install the app the application is using the activitity icon instead of the launcher icon. The problem with this is that the app icon get a transparent background color instead of a solid one.
What is wrong?
This is my manifest code for the application:
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:name="com.example.dev.MyApplication"
android:theme="#style/Theme.Example" >
This is the manifest code for one of the activities (the are all the same):
<activity
android:name=".ui.TasksDetailsActivity"
android:icon="#drawable/ic_menu_logo"
android:screenOrientation="portrait"
android:label="#string/title_activity_tasks_details" >
</activity>
The app is using the ic_menu_logo (transparent) instead of the ic_launcher (solid color) icon when installing the app.
Don't use "android:icon". Use "android:logo" instead:
<activity
android:name=".ui.TasksDetailsActivity"
android:logo="#drawable/ic_menu_logo"
android:screenOrientation="portrait"
android:label="#string/title_activity_tasks_details" >
</activity>

Launcher Icon shows up on emulator, but not on phone

As mentioned in the title, my launcher icon is showing up fine on the emulator, but the default icon was shown on my phone.
Here's my AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ytz.bc"
android:versionCode="1"
android:versionName="1.0a" >
<uses-sdk android:minSdkVersion="10" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name=".ProjectBriefcaseActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
</manifest>
Most likely, you have replaced the default icon with your icon only in one of the drawable folders, and coincidentally the emulator is using the folder, while your device is using one of the other folders. See this link for icon design guidelines, and this one for the recommended size.
Can you post what's there in all your drawable folders?
You might have done this thing: replaced the ic_launcher.png file in drawable-mdpi folder with another image(your launcher icon) and named it ic_launcher.png .
You actually do not need to rename the file icon file you out in the drawable folder, but you need to change the android manifest to tell the application which file to use as the launcher icon.
Suppose if i put launcher_icon.png in the drawable-mdpi folder, and i want that to be my launcher icon, i will change the manifest to this:
<application
android:icon="#drawable/launcher_icon"
android:label="#string/app_name" >
I changed the tag
android:icon="#drawable/ic_launcher"
to
android:icon="#drawable/launcher_icon"
paste your launcher image and do the change according to the file name of that image...
If you have placed your icons correctly, still you don't see the icon change then, go to Project->Clean....
In res folder inside bin you will find all your resouce items. You can check before cleaning the project and you will find that you have the old ic_launcher file. If you clean the project, these folders will be deleted. When you run your application again a new set of files will be copied and your application icon will be changed.
Hope this helps.
Note: This will work only when you have replaced the icons in all the folders still you are getting the old icon.

Categories

Resources