I have to manage different screen sizes and different densities in my Android app. I am not getting directory structure properly.
What I understand so far is there are four types of screen sizes:
- small
- normal
- large
- xlarge
and different densities as well:
- ldpi
- mdpi
- hdpi
- xhdpi
Now each device size (small , normal , large and xlarge) shall map against each density. Because every size can have different density, right? If yes, then we can say small screen have all the density i.e ( ldpi , mdpi , hdpi , xhdpi) same for normal, large and xlarge.
The point is how I'll manage them in my drawable directories. Will there be four folders for small screen size with different size (drawable-small-ldpi, drawable-small-mdpi, drawable-small-hdpi, drawable-small-xhdpi)?
And same for other screen sizes as well.
If not then how I'll manage all the image in ( drawable-ldpi , drawable-mdpi , drawable-hdpi , drawable-xhdpi) folder because different screen size I'll have different size of images. Then how can a small device with different density and large device with a different size be manageable in same density folder.
Please don't give me reference of any Android document as I read all that stuff.
If any one can't get my point, then please let me know. I'm very confused.
When I have started development in Android, I was confused about same issue.But now I have figured it out and I'm doing pretty well.
Anyways,
You are absolutely right
.you can provide different images by 4 folders for each.i.e.: drawable-small-ldpi, drawable-small-mdpi, drawable-small-hdpi, drawable-small-xhdpi
But it is just waste of your time
.because you don't need to worry this much about it.Android can scale up/scale down according to the device configuration.so just provide extra images for those devices only if you don't get desired outputs for them.As far as I know, supporting multiple devices, you have to consider
few general criteria
in your mind.Density qualifiers:
ldpi,mdpi,hdpi,xhdpi,etc
are generally used when you want to provide different resolution images.Size qualifiers + Orientation qualifiers:
small,normal,large,xlarge,sw600dp,normal-land,normal-port,etc
are generally used when you want to provide different layout designs.i.e.: single pane layout,multi-pane layout,different elements in layouts according to different screen sizes.
For reference:
Download the example app
from hereand try to understand
how it is being supported for multiple screens.I hope it will be helpful !!