Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xxhdpi density added in API 16, what in <16 if I provide only xxhdpi resources?

I'm working on a porting from iOS to Android, and since the iOS guy gave me only @3x versions of all graphic resources, I have placed them only in the res/drawable-xxhdpi folder. I know it's not a good practice to not provide alternative low-res resources, but according to official documentation:

By default, Android scales your bitmap drawables [...] so that they render at the appropriate physical size on each device. For example, if your application provides bitmap drawables only for [...] medium screen density (mdpi), then the system scales them up when on a high-density screen, and scales them down when on a low-density screen.

Now, documentation also says:

xxhdpi: Extra-extra-high-density screens; approximately 480dpi. Added in API Level 16

Then, my question. I don't give any bitmap alternatives aside from xxhdpi, so on devices running Android API <16 will this drawables be rendered at all? I tried the app on an API 10 emulator, and all my stuff is there. Should it be? If yes, why?!?

like image 855
lorenzo-s Avatar asked Oct 20 '22 15:10

lorenzo-s


1 Answers

The answer is yes, your resources will be rendered even on devices with API < 16.

Why yes?

This is just a finding: If you look inside the contents of the output apk res folder. The drawble-xxhdpi resource folder is converted to drawble-xxhdpi-v4

enter image description here

v4 qualifier gets appended with the drawable-xxhdpi folder. The v4 support library was designed to be used with Android 1.6 (API level 4) and this might have a connection that new qualifier resources are detected even on lower API devices.

Qualifiers have been defined to support different resolution devices in a better way. Once you're able to compile your APK with API >= 16 and a lower API device is supported by your app, the resources from new qualifier folders will be picked even on lower API devices if none of the compatible qualifier resources are detected.

Your test on API 10 emulator confirms this.

You should check the best practices, but I understand the question was not about that.

like image 145
random Avatar answered Oct 28 '22 23:10

random