All the Android docs mention the "drawable" directory. However, when I create an Android project in Eclipse, it doesn't create a "/res/drawable" directory, but it does create "/res/drawable-ldpi" and "/res/drawable-mdpi". I imagine those have something to do with pixel resolution, but what's exactly going on here? When I've stepped through the tutorials, I've manually created a "drawable" directory and put my resources in there, but did I need to? Do references to "/res/drawable/" work if only "drawable-{l|m}dpi" are present?
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.
Drawable xhdpi 官网 Compatible with IntelliJ IDEA (Ultimate, Community, Educational), Android Studio and 13 more. Quickly and easily convert images into images of various densities (LDPI, MDPI, HDPI, XHDPI, XXHDPI, XXXHDPI) used by Android.
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.
Hdpi is a 1.5:1, and can be thought of as a HD (high-definition) display. And xhdpi is 2:1, much like Apple retina displays. . The normal mdpi is based on a 160 dpi screen, which again is the same as a single pixel unit in your graphics software.
I believe this was added in Android 1.6. It's all explained here: http://developer.android.com/guide/practices/screens_support.html
Yes, you need to make a default /res/drawable directory in Eclipse.
If you want to use the -hdpi/-mdpi/-ldpi folders, then you need to make separate xml layouts to refer to them.
http://developer.android.com/guide/practices/screens_support.html
I assume it has something to do with how you generated the Android project. Typically mine creates an hdpi, mdpi, and ldpi folder. Basically, "drawable" is the default. If you have all of your resources in the hdpi folder, and try to run it on an ldpi device, I believe you will get an exception of some kind (I have not tested this, but I believe this to be the case). A detailed explanation of what happens without default resources is explained here.
You should keep a default collection of resources in the main "drawable" folder (that yes, you may have to create manually) just to be on the safe side, and to ensure compatibility with older versions of Android. Android will check the specific density folders first, but will roll back to the default drawable folder if it cannot find that specific resource in that density.
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