I have a rough idea of what each of these directories are for, but I'm not really clear on the concept and I have some specific questions.
For example, what are the target DPIs for each directory? When you create an asset, should it be at that target DPI or should it be at the more normal 72dpi screen DPI? If you're targeting multiple devices, is it ever appropriate to put a PNG in drawable or should you always have multiple versions slightly tailored to the specific screens?
Thanks.
The size are not exact but upto 130dpi it is considered small, from 130 to 180 it can be considered mdpi, from 180 to 200 it can be considered as hdpi and the higher is classified as xdpi.
1.0x — medium-density (mdpi) 1.5x — high-density (hdpi) 2.0x — extra-high-density (xdpi) 3.0x — extra-extra-high-density (xxhdpi) 4.0x — extra-extra-extra-high-density (xxxhdpi)
these are image folders for different densities. hdpi images for the Android Broad Screen set or Android Phones with the Higher resolution. ldpi Lower images quality supported by the earlier sets of the android. mdpi for medium images support. xhdi devices with maximum resolution.
As the others have suggested, the Android online documentation has great articles on this. However, I'm going to try and list here some quick and helpful tips:
1
. Then, LDPI is 0.75
and HDPI is 1.5
. What that means is that if you have a drawable that is, say, 50x50
on a MDPI screen it will have to be ~37x37
on a LDPI screen and 75x75
on a HDPI screen, in order to appear at roughly the same physical size on each screen (i.e. 2cm if you put a ruler on the screen). Also, your computer screen is most probably MDPI, which is why it's recommended to start with MDPI drawables and then resize them: the physical size of the drawable will be very close between your computer screen and an MDPI Android device. If you view an HDPI drawable on your computer and on an HDPI device you will notice that it's much bigger (again, physically -- put a ruler on it style) on the PC screen.ListView
can show 5 items on a MDPI device it might be able to show 6 items on an HDPI device, in spite of the fact that the ListView
items have the same density-independent (i.e. 1.5 times larger on HDPI than on MDPI) height.I might have gone a bit offtopic, but these are things I have learned in time by banging my head against them. Just trying to save someone else's headache :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With