I wanted to ask how to change the app icon of my app on a Galaxy S7 running on Android Nougat (see attached screenshot) to fill the whole icon space.
Is there a way to do this?
EDIT: I think it's because these apps have square icons and mine is circular. Is there a way to make it square for Galaxy S7 Nougat devices and for all others round?
You can disable this by adding a meta-data element to your manifest:
<application>
<meta-data android:name="com.samsung.android.icon_container.has_icon_container" android:value="true"/>
</application>
This solution is only for user's end:
Go to settings -> display -> icon frames -> icon only.
This should change the icons into full size icons.
From https://developer.android.com/about/versions/nougat/android-7.1.html
Apps can now define circular launcher icons, which are used on devices that support them. When a launcher requests an app icon, the framework returns either android:icon or android:roundIcon, depending on the device build configuration. Because of this, apps should make sure to define both android:icon and android:roundIcon resources when responding to launcher intents. You can use Image Asset Studio to design round icons.
While that may not be sufficient to deal with Samsung's "special" white frame for icons, this gif shows a few ideas for creating icons that look good whether they are the normal size or framed "Squircle" style.
https://www.androidcentral.com/sites/androidcentral.com/files/article_images/2016/12/squircles.gif
In any event this means you now have to worry about a normal icon, a round icon and a Samsung-ized icon and there is no way to provide an icon for the Samsung-specific launcher design.
I met the same problem and tried various things. Now I found one interesting thing.
If you make an icon without any transparency, the icon will be the full size on the Nougat android phone. When I made an icon in the paint.exe and saved it as .png, there was no problem.
I think this will help you.
EDIT : below is what I met, explained in my comment
EDIT2 : the sizes and shapes of two icons (with and without transparency) are identical. the only difference is one has transparency and the other has white background. Definitely I don't mean that I deleted transparency and enlarged the image.
EDIT3 : more explanation about my icons #Hadas
Related
I have an app on android that create home shortcut icon.
The image of the icon is image that i set programmatically from the drawable
Now the problem is, when the shortcut was created on the home screen it's created with white background.
How do i remove that white backgroubd and set image to full size of icon?
Thank you all..
EDIT: the app i was talking about is app that i developed using android studio and just want to set full size of image when i create home shortcut
This is highly dependent on the launcher you use. The image looks like the standard google android 8+ (?) icon shape.
I theory it could be part of the icon you created but since you are asking this I doubt it.
In older versions of android the outer shape of the icons were individual, while rather cool and the outline correctly shown while dragging them etc many complained about the lack of a uniform look of all the icons in the app drawer etc.
It was introduced to make all icons seem more uniform.
Long pressing an empty space in the Google Pixel launcher for example shows a choice to go into the settings for the launcher and there you can change the shape all icons should have:
In addition to this, apps can take advantage of the various shapes and adapt to them and fill them out so to speak. See for example the Chrome icon while changing the icon shapes in the launcher settings.
Introduced in android 8: The feature is called adaptive icons.
See the docs about adaptive icons here:
https://developer.android.com/guide/practices/ui_guidelines/icon_design_adaptive
That is because of adaptive icons - a feature of Android 8 and can't or shouldn't be changed. You can at best change the colour of the background.
i removed the white background from the launcher icon by following these guidelines https://developer.android.com/studio/write/image-asset-studio
a few more points
in the background layer, move the slider to resize the icon until you see no what would have been the white background.
in the manifest file, change the icons to reference the mipmap folder;
android:icon="#mipmap/yourlogo"
android:roundIcon="#mipmap/yourlogo"
I am trying hard to get rid of the extra margin around the ic launcher icons generated by Android Studio without luck. I know this is one of Google's material design trends. Though, the icons are so small on devices which is ugly.
I have Googled for around three hours and the only workaround I could find is to generate the clipart with a transparent background and photoshop the background with rounded corners which is pretty slow.
Is there a better solution than this?
Thank you.
Per the Designing adaptive icons blog post, the adaptive icon images created in the drawable directory for use on API 26+ devices follow the adaptive icon size and shape:
You'll note that while the entire image must be 108dp by 108dp, the actual visual area is only the center 72dp - the outer edge is only seen when dragging the icons around (where parallax effects may cause it be visible).
The Pixel Launcher, as well as many third party launchers, enforce the use of adaptive icons on API 26+ devices, so you should always design with that requirement in mind - the alternative, in the Pixel Launcher's case for instance, is to place your non-adaptive icon within a white circle.
Therefore you should always design your icon such that the background layer takes up the full size, but any foreground image you put on top of that background layer should be contained within that center area.
You can't just remove that margin without the foreground image being messed up, but as per the Implementing Adaptive Icons follow up blog post, you can remove any white excess around the foreground by putting your trimmed image within a transparent drawable of 108dp x 108dp by using an InsetDrawable.
<!-- Center a 54x54dp image in the 108x108dp size of adaptive icons -->
<inset
android:drawable="#mipmap/ic_fg_trimmed"
android:insetLeft="25%"
android:insetTop="25%"
android:insetRight="25%"
android:insetBottom="25%" />
Although this would have to be something you'd need to do to the ic_launcher_foreground image yourself after the fact.
A better solution, in most cases, is to use vector drawable images as the input to the Android Studio Image Asset wizard - this will ensure they are always the right size and don't take up any additional space in your APK.
I think i had the same problem as you. I solved this with a nasty hack, in the AndroidManifest.xml I just changed the roundIcon to point to the standard icon.
<application
…
android:icon="#mipmap/ic_launcher"
android:roundIcon="#mipmap/ic_launcher"
See more from the docs.
My problem is that the App Icon on my device looks way too small in comparison to the other apps. I read some solution on other questions, like this one Android App Icon size too small but this doesn't seems to be my problem. In the Android Studio you can make a right click on "res" where you can find new --> image asset where you can create such a icon. it creates icons for all the different sizes like mdpi, hdpi and so on. So i thougt that i might display the app icon correctly but it doesn't. can anybody help me?
In "Configure Image Asset", click "Legacy", change "Shape" from "Square" to "None", and the image padding will appear. Go back to "Foreground Layer" and resize the image to fill the padding.
Try to use this. Its very useful, fast and free. And thats what I use.
If your icon already has a shape, remember to set the shape to none. Hope it helps!
If you are getting the same results, I also recommend this website, where I usually get "bigger" icons.
I found the launcher icons generator puts there a small padding, that is the reason for smaller icons. On the other way it is recommended by Google team here.
Android expects product icons to be provided at 48dp, with edges at 1dp.
All is on you to decide. In case the icon applies to whole square space - use padding, otherwise when small object is not square shape, rather fit to edges :)
I had the same issue. I fixed it like so:
Create the adaptive icon through Android Asset Studio. In the third tab you can select "Create Legacy Icon". Only this legacy one is going to be too small! The others will be fine.
So the thing I did was just to replace the icon_launcher.png files (this is the legacy icon).
If you use any single image directly as android:icon="#drawable/ic_launcher"
It'll be shown correctly on old devices but on android 26+ it'll appear small
Use this approach to make the icon appear like fitXY scaleType for imageview, that is, it's corners can be clipped like cardview but it will not be shrinked
Step 1
Delete ic_launcher from drawables and paste it in mipmap-xxhdpi-v4
Add transparent padding of width/6 px to your launcher icon online
Step 2
Paste the second file as ic_launcher_foreground
Step 3
Create ic_launcher.xml under res/mipmap-anydpi-v26 and add this content
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<foreground android:drawable="#mipmap/ic_launcher_foreground" />
<background android:drawable="#color/colorTransparent"/>
</adaptive-icon>
Step 4
Edit the manifest and use mipmap instead of drawable
Now your icon should not appear shrinked/zoomed
This is useful when your app icon can't be split into foreground/background eg some graphic image as app icon
How it works:
For API26+ devices, mipmap-anydpi-v26 will take precedence over mipmap-xxhdpi-v4 and system will load icon from xml, which in turn, loads foreground from ic_launcher_foreground, automatically crop 2/3 of its size because it's 'adaptive icon'. (This is the reason we add padding of width/6 from all sides
For older devices the ic_launcher.webp will be used directly
Tested on API 21-31
I have following issue, am developing an App for Android and I realise that the launch icon AKA ic_launcher is quite smaller than al the rest of the App that I got from GooglePlay.!see image below.. I tried as normal (on eclipse: new->android icon-set->....) using a 512x512 png file, then I gave a 2nd try using a recommended link I found by searching a solution (Android Asset Studio)
you may want to say " is not tooo much" but that is what I need, must be the same size as normal apps...
thanks in advance!
see the dotted line as reference to verify the size
Just create icon 512x512px without any generators, they add margins to a picture. You have to draw icon from border to border.
Use an existing application icon as a template, for example - mine
I have realized that there are at least two background colors on Option menu of Android. On the HTC Hero, the background is white and on Samsung Galaxy S II, the background is black.
This became a problem when I set the icons for the background menus. Is there some way to detect the background color of the Option menus in Android?
Possible solutions:
Don't use icons.
Design icons according to the guidelines - http://developer.android.com/guide/practices/ui_guidelines/icon_design_menu.html. There are three different guidelines for up to 2.2 (white background), 2.3 (black background) and 3.0+, so it's a lot of work...
As Profete162 suggested, use #android:drawable/ic_menu_*
For Android 4.0+, you can also set the light / dark Holo theme, which is guaranteed (at least in theory) to remain unchanged across different phone manufacturers - so it'll look the same in HTC Sense, Samsung TouchWiz etc.
That's indeed a very annoying issue.
On my implementation, I always try to use standards icons from android.R.drawable.IC_menu_*, so I am sure these icons are part of the framework and users are always positively surprised to see their generic icons in my app!
That gives a really good continuity in the user experience on the device, but that doesn't answer your question, but at least provide a workaround.
Here are for instance all android 2.2 icons: http://androiddrawableexplorer.appspot.com/
You can trust me, using these icons will always fit your colors.
First of all to answer your title question:
You can reference and read the background of the options menu by reading the attributes of the current theme. The attribute for this is panelFullBackground. E.g. set it as the background of a textview in XML¹:
<TextView android:background="?android:attr/panelFullBackground"
... />
Note that the background seems to be a solid color, but it's not - it's actually a bitmap. If you look closely you can see a grey border at the top (android 2.3+), or a drop shadow (<= android 2.2), so its'a bit difficult. Luckily there is a different attribute called panelColorBackground which matches the background color of the drawable as close as possible. So if you want just the normal background color, use this instead.
¹ This can surely also be read from code, but I don't know how from the top of my head at the moment, maybe I'll look it up and edit it in later.
Regarding icons
So you have the color as stated above, but you still have to process it to know if it's a dark or a bright color. You can do that, but that's not the usual way to deal with these icons and probably a good bit of work until you cover all the possible cases - not to mention that you have to create icons for each variant.
Normally you should adopt the platform menu icon style. This works across all devices and looks familiar to your users (custom icons that dont follow this often look "wrong" - e.g. astro file manager does this I believe).
You can do that by hand (see the guidelines), but the way better alternative is the Android Asset Studio.
It comes in two flavors:
As a webapp
Integrated in the latest version of the ADT plugin for eclipse
(under File->New->Other->Android Icon Set)
The workflow for both is pretty similar, select the point "Menu Icon" and follow the wizard. It will promt you to enter a simple, black and white bitmap of your desired icon that just outlines it's shape. After you specified one, the asset studio will generate everything for you. Play a bit around with the "clipart" option, that has a few example bitmaps ready to see how it works. When finished, the webapp gives you a simple zip which can be extracted into your project directory, the eclipse version adds it directly to the project that you select in the wizard.
The background color can be anything, because its implemented in Framework by manufacturer. You can't read it, in fact you will never need to read it.
Just create your custom menu layout in res/menu folder, set style and use it.