I've created a menu icon and included a 36x36, 48x48 and 72x72 in the ldpi, mdpi and hdpi drawable folders. It looks fine on all devices except honeycomb tablets, where it seems like the padding around the Android icons are bigger than on my custom icon. I've included a screenshot (see how much bigger my 'Resume Reading' icon is than the android 'Back' and 'My Library' icons are). How do I make my icon look like this?
I think I found the problem. When using the Android resource icon's on a tablet, I think it changes the padding in order for the icon to be used in the action bar. So when displaying them in a pop up menu at the bottom they are appearing much smaller than they should be. The solution is to copy the android resources into our own resource folder as it says to do here http://developer.android.com/guide/practices/ui_guidelines/icon_design_menu.html
Most of your Tablets are not hdpi, they are xhdpi. While the Icon Design Guidelines are useful, they don't give the whole story. Consider reading Supporting Multiple Screens. Here, they tell you further ratios and dimensions. To save you some time, resources should be 3ldpi:4mdpi:6hdpi:8xhdpi meaning that your xhdpi icon should be 96 x 96. Please, read the whole document, though. It is insanely useful.
Related
I have an app that has buttons with background images that I specify in the layout. For mdpi and up it works fine and you can see the images. But I recently started tested on a small device and saw the backgrounds only show black. I then checked the screen size (small) which I cater for and also checked the density, which I saw in this case is ldpi. So I rescaled the mdpi images to 36x36 and created a mipmap-ldpi folder. Android studio sees it in design time but for some reason it is not picked up at runtime. So I Googled around and saw that I might have to add them manually via Android Studio. So I created a New Resource Directory where I specified the density as ldpi as below :
I then for each Icon added a new file with the same name and selected the ldpi folder as below :
And select ldpi directory :
I then entered the same name as it is with all the other densities for each icon / image.
After all this I still get black background so I thought let me try and assign the background programmatically. That then works. Can anyone help me with why it will not work when specifying it in the layout file. I have a layout file specifically for small screens. Must I specify density as well ?
Apologies for the images. I see I cannot embed yet because my reputation is too low.
Update 1 :
Moved all the icons to Drawables as recommended and it was still doing it.
Read other articles where LDPI is not really supported anymore and then answered the question as to make the problem go away by not supporting devices with LDPI density.
But the next day then picked the same problem up on a old S2 with HPDI density. So it is possibly not a LDPI problem anymore until proven otherwise. Hopefully we will find the problem and get it fixed.
The mipmap directories are used to store the launcher icons. They are not used inside the app, but at the home screen and the app listing.
The reason is, when a resource from drawable-directory is requested, a bitmap is chosen from the folder that matches the current density. But, when you use the mipmap drawable, the launcher may choose an icon from a different folder (usually a size-up). That's why you're not seeing the ldpi icon.
Some launchers actually display the icons larger than they were intended. Therefore, using the mipmap for launchers helps in this.
Also check this link out.
SUMMARY: use drawables for icons used inside the app and mipmap for the launcher icon of the app.
Apologies. I asked my question incorrectly. I assumed it was the icons but I neglected to mention I call the icons from Layer-List drawables. Turns out Layer-List draws black on some devices that runs Android 4.0 and 4.1 if you do not explicitly mention transparent as a color. I can now see all icons from ldpi up.
Thanks for your assistance. Reference link : Android xml layer-list not displayed correctly on some devices
What is the correct size to choose for Vector Drawable icons e.g. when importing them from SVG?
There is a lot of information about standard icon dimensions for raster icons, for example this site. However, I'm a little bit struggling to get icons imported from SVG appear normally, I'm basically determining them by trial and error.
Particularly interested in launcher and notification icon sizes. I've currently settled on 192x192 for launcher icons and 48x48 for notification icons.
Using a smaller size for launcher icons results in a blurred icon on my KitKat tablet and using a larger size looks bad as well.
But the notification icon still appears larger than in other apps so it should probably be something like 32x32.
You choose what is the best, what it depends on is the version of Android, the default is 24x24 dp
Here is a image of my android icon for the app Contak (in red) compared to some other icons:
. My image was failing to upload to imgur, so sorry I couldn't embed.
My icon is a decent amount smaller than other icons and it bothers me somewhat. I saw other questions where people put wrong sized icons in the drawable folders, but I used the new built in SDK tool and put -10% on padding so it shouldn't have an error.
I also added:<supports-screens android:anyDensity="true"/> into my app. Any ideas what's up? Thanks in advance!
See Documentation on Iconography for details. I assume that the SDK tool left some padding around your icon.
Open the MDPI icon (which should be 48x48 px) and see if there is transparent pixels around. If yes, then you might want to enlarge the icon a bit to cover the whole 48x48 px.
I have a quick question: will it work when I put the same 57px x 57px icon to all drawable-ldpi, drawable-mdpi and drawable-hdpi folders. Will it run on all devices?
in other words if small icon will be visible on big screens or x-large screens.
It will work, but you really should not use size of 57x57 for any screen size - scaled down images will look as ugly as scaled up. Better avoid it.
Please read more here: http://developer.android.com/guide/practices/ui_guidelines/icon_design_launcher.html (yes, it is an official documentation).
Yes, it'll work. But it is good to have all icons. Because it'll be pixelat on large screens.
If you simple put icon in drawalbe folder (which is default folder) and you don't have any other folders like hdpi, mdpi, ldpi for all screen sizes. then it'll also be considered for all resolutions/sizes.
It will work. But it will not look well on some screen.
I have a drawable-xhdpi-v11 folder containing a 48x48 icon which is used in my Notification:
Notification notification = new Notification(R.drawable.ic_not_logo, null, now);
I noticed on my Galaxy Nexus running JB, the icon is shrunk to 36x36, making it blurry. Why does the documentation ask for a 48x48 if it wants a 36x36? Am I missing something? Is there a way to make my notification icons pixel perfect?
EDIT:
Here is a related post
Android status bar expects icons of size 25x25dp while guidelines recommend 32x32dp. Who is wrong?
The answers in this post do not explain why it still asks for a 48x48 sized icon and down scales it to 36x36.
You should provide different version of the very same resource.
Follow the guide: android design status bar
My final conclusion is that it is impossible to have pixel perfect Notification Icons. I experimented with providing different sized icons to the drawable-xhdpi-v11 folder and it down-scales all icons provided regardless of their size, leading to a loss in resolution and blurriness of pixel perfect icons. Pretty disappointing.
You should definitely stick to the 24dp value from the guidelines, but you must provide an xxhdpi res (72px) which can then be used by Android to scale to 36px without blur. Same with app icons, some tablets use the xxhdpi res for the homescreen, even though the device is xhdpi.