I am very curious what kind of size of images I have to hold in Resources -> drawable folder.
Because in other drawable folders like mdpi, hdpi and etc I am holding size of images regarding documentation. As I know in drawable folder there should be default images if device do not recognize what kind of type of drawable folder is required, then application loads from default folder - drawable. So what kind of size images, you would suggest to put? Thank you for all answers and suggestions.
Well, I find out that is mostly recommended to have images in drawable folder(default) from drawable-hdpi folder.
And here is recommended sizes for each folder: http://iconhandbook.co.uk/reference/chart/android/
Related
What size of image should I put into drawable folder which is not drawable - ldpi, hpi, mdpi, xhdpi,xxhdpi, xxxhdpi? Or do I still need the drawable folder?
Yes, we still need drawable folder. All the folders you mentioned help android app to store different density images according to their density but when you access them into your app system will select the appropriate image based on the screen's API.
You could also follow documentation for further details here.
I am directly adding images in drawable folders and it is coming fine with ImageView tag android:src="#drawable/image_name" but I wonder what to do with the other drawable folders as shown below.
Do I need to add same image in all drawable folders or my way of adding images in drawable folders is wrong?
Please help me!
The image is same, but the size should be different for each folders.
If you add the image only in drawable folder, same image will be loaded for all screen resolutions. So for eg: if the image size is small, this may result in bad image quality.
You can find a similar question here
I use Android studio plugin Android Drawable Importer
All these drawable folders represent different android phone densities. The best folder to put your images is drawable-xxhdpi as android automatically downscale or upscale the images depending on your devices density and most phones these days are on xxhdpi density.
If you put a image in drawable folder only there are chances that image may get distorted(as it upscales) in xxxhdpi density.
If you are putting images in xxhdpi ,make sure you create your images acc. to xxhdpi resolution.
If you don't feel the image is looking right in some phones than check the density of that phone and put an image in that specific density folder acc. to it's size(reduced or increased).
Just put it in the drawable folder, no need to put it in other drawable-... folders because those folders and contents inside are created automatically by android studio.
I found this link Why don't some xhdpi mobiles display image located in /res/drawable only? and according to the answer "you should not put images files in the drawable folder". Is it true? there is a link in that answer but does anyone have an official reference on this matter. I search for an answer but still did't find any. Please help me to understand the drawable folder.
"you should not put images files in the drawable folder". Is it true?
It is not true, as long as you remember the fact the drawable is a shortcut for drawable-mdpi, so your drawable as in fact been scaled density-wise.
Drawable folder is meant to hold images.
There are many drawable folder with customization, like
drawable-mdpi : devices which fall under medium density will take images from this folder.
drawable-mdpi-port : devices which fall under medium density and the orientation is portrait will take images from this folder.
Priority matters. Suppose the device is medium density and not in portrait mode, then it will take in drawable-mdpi.
The default folder is drawable, this folder will be in use under the following situations.
If the device doesn't fall under the specified customization.
If the item image is common for all density and resolutions.
When I use a single Drawable folder, my images resize depending on the resolution of the device.
My current solution is to copy all the same images into each Drawable folder (hdpi, xhdpi, ldpi, mdpi), but that is making my APK file really big.
How can I disable the automatic resizing feature?
Using resource folder drawable-nodpi may help.
My android app requires over 1000 image icons to show in a image list view. I have all those images in a folder. I want to load all images from that folder and show them in an image list view.
But Drawable folder in Android offer following:
drawable-hdpi
drawable-ldpi
drawable-mdpi
drawable-xhdpi
drawable-xxhdpi
I found that there is no way to add a subfolder in any of these folders. Also, if I have to provide different resolution images for all drawable folders which seems complicated for me. I think then the app size will be multiplied by 4-5 times and I will also face difficulty to separate these image files with other images of the app. I think there is a better solution for it? Can you please give any idea about how to achieve it?
If you are ok with only having one size of the icons you can place them in the resource folder named drawable (without any extra qualifiers). I suggest you use a common naming scheme, like my_icon_XYZ.png, where XYZ is a number starting with 001.