androidloadingdrawabledirectoryresolution-independence

Android using drawable folders


Simple question. How does android work with drawable folders if any folders are empty ? Lets say I have images only in folder "drawable-hdpi". When I start application on emulator with higher dpi "drawable-xhdpi" it load images from "drawable-hdpi" (of course in bad size). Also when I start application on device with lower dpi "drawable-mdpi" it load images from "drawable-hdpi".

My question is - does it mean if doesn't exist images for current device dpi, android system takes images from other folder it is not empty ? Till today I thought, when images in current dpi are not present, application doesnt work.


Solution

  • It takes the near dpi, and scales the image up or down by the dpi difference between the target dpi and the folder dpi. If in the "drawale" folder (no dpi), no scaling takes place.