On the topic of included standard icons the Android documentation mentions that:
Shown below are standard menu icons
that are used in the Android system.
Because these resources can change
between platform versions, you should
not reference the system's copy of the
resources. If you want use any icons
or other internal drawable resources,
you should store a local copy of those
icons or drawables in your application
resources, then reference the local
copy from your application code. In
that way, you can maintain control
over the appearance of your icons,
even if the system's copy changes.
Note that the list below is not
intended to be complete.
In my application I'm using such standard icons such as "ic_menu_sort_alphabetically" and thus I've tried to find these icons, so that I can include them in my application.
However, in "android-sdk/platforms/android-8/android.jar" I only find the icons in drawable-mdpi and in drawable-hdpi - there is neither a default drawable folder with icons, nor a drawable-ldpi folder with low-resolution versions of these icons. However, such a low-resolution version would be required to provide native versions on ldpi devices such as the HTC Wildfire.
Are there any "official" versions of the Android icons scaled at ldpi? While it's likely that the ldpi versions are stored somewhere on my HTC Wildfire device, I assume that they are copyrighted by HTC and not under the same open-source license as the icons in the Android distribution.
If you can't find the pre-scaled images, you can just open the mdpi in Photoshop or GIMP and resize them by 75% to make the ldpi icons. To make hdpi resize the mdpi image by 150%.
Related
Google Play states that my app is not designed for tablets: "Your APK should include custom drawables assets for common tablet screen densities." It links to 4. Use assets designed for tablet screens on the Tablet app quality page. I'm trying to understand how I'm not compliant with section 4, and I'd appreciate insights.
Is section 4 on tablet assets even accurate for Action Bar icon sizes? It looks like 32dp is the specified size (32x32px at mdpi), but that appears to conflict with the material touch target size specification, which specifies 24dp. I use 24dp assets from the Google material-design-icons suite for my Action Bar (Toolbar), and there is no such thing as a 32dp Android icon in the suite.
I have included drawable-xhdpi, drawable-xxhdpi, and drawable-xxxhdpi PNG drawable assets in my project, but I have not included drawable-hdpi assets. Could this be the reason why I'm not "designed for tablets?" The documentation states that all drawables should be "optimized for at least one" of hdpi, xhdpi, xxhdpi, or xxxhdpi sizes, and I have done this for at least one.
My launcher icon sizes are correct and include mdpi - xxxhdpi versions (mipmap-mdpi, mipmap-hdpi, etc.).
For anyone struggling with this, I submitted the Design for Tablet Contact Form, which you can use to let Google know why you believe your app is designed for tablets (even though it is not labeled as such). Google reviewed my submission and agreed, and the app is now labeled as designed for tablets.
Before submitting the form, you should make sure that your app meets the Tablet App Quality Checklist first.
I have a bit of a weird bug/issue with one of the apps I'm working on. On some devices running Android 6, the app icon is smaller in comparison to the rest of the icons from other apps.(See attachment) Any idea why?
I've checked and the ic_launcher have the right resolution - according to this: Android - Launcher Icon Size
Probably also worth mentioning that the icons were generated using the icon generator within Android Studio.
Thanks!
Drawables and mipmaps are nearly identical even mipmaps are mostly used for launcher icons and drawables for other things. The suffixes (e.g., -mdpi, -hdpi) are filters,
indicating under what circumstances the images stored in those directories should
be used. Specifically, -ldpi indicates images that should be used on devices with
low-density screens (around 120 dots-per-inch, or “dpi”). The -mdpi suffix indicates resources for medium-density screens (around 160dpi), -hdpi indicates resources for high-density screens (around 240dpi) and so on.
Android Studio offers an Image Asset Wizard. This wizard is designed to take a
starter image and give you icons, in a variety of densities.Android will calculate density of the screen on which app is installed and by that it will take the correct icon. If there is non than Android will take the nearest one. You can find more about mipmaps and drawables on official developer site or any relevant book about android programming like The Busy Coder's Guide to Android Development.
There is Android Asset Studio which you can use in Chrome browser to generate your icons: https://romannurik.github.io/AndroidAssetStudio/
it seems that the problem was the selected shape when generating the icon with the Images Asset tool in Android Studio. Square is selected by default. Selecting none fixed the issue.
Switched my eclipse project to Android studio. I was maintaining resources under drawable-mdpi folder only. Now in studio the preview of XML loads images correctly. However when I run the app in a device with resolution higher than mdpi the app crashes, shows error inflating binary XML.
After a long analysis I found the issue that the device was trying to load images from its corresponding density folder which is not available. So I created the folder drawable-xhdpi and put images in that folder. Now the app works fine.
Why android studio can't pick image from other density drawable folder and resize which is possible by eclipse. I can't maintain 5 different drawable folders because there are lots of images.
you have to add "drawable-hdpi" resource directory and paste all the hdpi resources there because currently 70% android devices supports hdpi resolution images.
if you only maintain the hdpi, then it is also ok.
android manages all remaining resouces from hdpi resouce directory.
Android application resource directories provide different layout designs for different screen sizes and different drawables. These different drawables are used by android to support a major range of all the android devices present out there. It's a standard practice to put your resources considering these densities. Coming back to your query:
Why android studio can't pick image from other density drawable folder and resize which is possible by eclipse. I can't maintain 5 different drawable folders because there are lots of images.
For your case,In order to maintain this you could create a drawable with nodpi and put your all resources there. nodpi focus resources for all densities.Your resources should be density-independent resources. The system does not scale resources tagged with this qualifier, regardless of the current screen's density.
Hope this will clear your doubts, for more insight you can also look this.
you don't need to add all images to each difference size folder but depending the size of the image you might need to add images to different folders.
simple example is this can occour once you add high res/size images in normal drawble folder
Skipped 100 frames! The application may be doing too much work on its main thread.
This might not crash your app but will make it's performance down.
and
Different density folders were added later on for Android which means that...
If you wanted to be lazy and just add one asset the best choice would probably be the HDPI asset if your min app target < 8 and XHDPI if its >= 8. This is because the system will scale the resource up and down, but you would still want to start off with the highest resolution possible.
If you want to have complete control over how the assets are scaled then you can by all means provide your own for all / some of the densitys. In practise I generally provide HDPI / XHDPI as above and give all the resource buckets for things like logos / AB icons / App icons etc. I generally find the auto scaling to be pretty good and work for most situations, but will occasionally have to supply and extra LD/MD asset if its a small asset / contains small text etc. Plus if i duplicated all assets for things like XXXHDPI I would get pretty good apk bloat.
You can also use IDEs built in tools to add a single asset for many densitys at once. In Android Studio 0.6 this is File->New->Image Asset and a wizard will appear.
I have never noticed or heard of any perfomance impact of allowing Android to scale assets automatically - presumably this is done in hardware.
It may not look great when auto scaling down to LDPI say so you can optionally provide your own scaled assets for all other densities.
taken from : https://developer.android.com/guide/topics/resources/providing-resources.html#AlternativeResources
Do we need to add all images with different dpi to Android Apps
When you include icons for multiple screen sizes in your Android application are the icons that don't apply to that screen size purged when the application is installed on a device? For example, if I have a tablet that has an xlarge screen that has a xhdpi density are the icons in the drawable-ldpi, drawable-mdpi and drawable-xhdpi folders purged when the application is installed (assuming drawable-xhdpi has all the necessary icons)?
Yes. All resources in will be included in the apk. The apk is the installed application; there's no point at which the resources are copied elsewhere before running it. You can confirm this by installing your app on a Nexus 10, then using adb to make it emulate other dpi targets. Even though you've installed the apk when the device was at a xxhdpi, relaunching it at mdpi doesn't kick off another install, the mdpi resources are already there.
A solid strategy for reducing the size is to simply not use large images when they're not necessary. I use conservative 9-patches and substitute xml drawables for shapes when appropriate. If you've done everything you can and you're still concerned with the apk size, you can create multiple apks that target different dpi points.
It has to have one of each of those icons in the apk. So it will increase the size.
Yes it will but you can use programs like OptiPng to compress your PNG Images so the size of the application wouldn't be affected much.
I have noticed on the Motorola xoom, that the applications icons on the Launcher are 72px by 72px. This is normally the size of icons defined in drawable-hdpi/ in packages.
In my application I want to display the icons of some installed applications on that 72x72px size. I currently fetch the icons of installed apps via the PackageManager, but it returns me bitmaps of inferior size (46px), which corresponds to the resources defined in drawable-mdpi/ of each package. This is not acceptable for me as I would like to display these icons in a larger format.
Apparently the 10" screen of the Motorola xoom is 160dpi, thus mdpi and xlarge (see http://developer.android.com/guide/practices/screens_support.html#range).
This would explain the behaviour of PackageManager returning me mdpi resouces instead of hdpi resources.
How could I get the icons of installed applications in a size of 72x72px minimum? Does anyone knows how it was done in the Launcher application on Android Honeycomb?
Thanks,
Laurent
You can create special sub-folder in your res folder and call it like drawable-large-v11, or drawable-large-v11, or other name suitable for your application.
Then copy large icon to that sub-folder, but filename must be the same as in other folders for different dpi's. I've used such approach in my applications and it works great.