Android XXHDPI resources
According to the post linked in the G+ resource:
The gorgeous screen on the Nexus 10 falls into the XHDPI density
bucket. On tablets, Launcher uses icons from one density bucket up
[0] to render them slightly larger. To ensure that your launcher icon
(arguably your apps most important asset) is crisp you need to add a
144*144px icon in the drawable-xxhdpi or drawable-480dpi folder.
So it looks like the xxhdpi is set for 480dpi. According to that, tablets use the assets from one dpi bucket higher than the one they're in for the launcher. The Nexus 10 being in bucket xhdpi will pull the launcher icon from the xxhdpi.
Source
Also, was not aware that tablets take resources from the asset bucket above their level. Noted.
if no xxhdpi resources are in the folder?
If you don't have any xxhdpi resources it will try to take resources from the "best" source possible.
from the google developer site:
- The system uses the appropriate alternative resource
Based on the size and density of the current screen, the system uses
any size- and density-specific resource provided in your application.
For example, if the device has a high-density screen and the
application requests a drawable resource, the system looks for a
drawable resource directory that best matches the device
configuration. Depending on the other alternative resources available,
a resource directory with the hdpi qualifier (such as drawable-hdpi/)
might be the best match, so the system uses the drawable resource from
this directory.
- If no matching resource is available, the system uses
the default resource and scales it up or down as needed to match the
current screen size and density
The "default" resources are those that are not tagged with a
configuration qualifier. For example, the resources in drawable/ are
the default drawable resources. The system assumes that default
resources are designed for the baseline screen size and density, which
is a normal screen size and a medium density. As such, the system
scales default density resources up for high-density screens and down
for low-density screens, as appropriate.
The sense of providing MDPI and HDPI resources
I don't think it is worth to provide resources for every density. I have an app with a lot of resources, and I decided to try providing only xxhpi resources.
I didn't see any difference in lower resolution devices, and I was able to reduce the .apk from 7.3MB to 4.4MB!
This said, even if you lose (let's say) 15% of quality, it will compensate only by reducing the .apk size, and consequently an increase of downloads!
Android drawble-xhdpi, drawable-xxhdpi, drawable-xxxhdpi subfolders inside DRAWABLE-V21 also for DRAWABLE-V23?
Resource qualifiers can be used in combination with each other (though there is a specific order that must be followed when combining them). All qualifiers and their precedence order are listed here: https://developer.android.com/guide/topics/resources/providing-resources#AlternativeResources
You could, therefore, use a directory structure like this:
res/
drawable-xhdpi-v21/
ic.png
drawable-xhdpi-v24/
ic.png
drawable-xxhdpi-v21/
ic.png
drawable-xxhdpi-v24/
ic.png
Your own answer, however, implies that there is no difference between the ic.png
file used for v21
and v24
. In this case, there's no need to specify the version at all:
res/
drawable-xhdpi/
ic.png
drawable-xxhdpi/
ic.png
Is there a way to create xxhdpi, xhdpi, hdpi, mdpi and ldpi drawables from a large scale image?
I was using "Android Asset Studio". Now I am using IconKitchen, the successor to the Android Asset Studio, and a great new way to make highly customizable app icons for Android, iOS, web, Windows, Linux and Mac.
Resources$NotFoundException drawable-xhdpi from drawable resource
As you have stated, if the phone / tab accesses the xhdpi directory then we expect it to scale the image appropriately to fit the screen. Therefore we expect that if the resource exists in ANY ONE of the directories then we will never see a ResourceNotFound exception. HOWEVER:
xhdpi was only introduced in Android SDK 8, so if you target SDK 7 and earlier you may run into problems:
Only use XHDPI drawables in Android app?
Another reason why Android may not be able to access the xhdpi directory is if the device is running in screen compatability mode:
Android - Extra large images placed in res/drawable-xhdpi aren't showing on tablet emulator, why?
Another possible reason is if your drawable is very small and one of its dimensions is rounded to zero as a result of scaling:
Android resource not found because of width and height
Finally, it is possible that some OEM versions of Android may implement this in a non-standard way (e.g "enhancing performance" by not searching the xhdpi directory if their device is hdpi):
Android Drawable hdpi xhdpi mdpi ldpi concept
Related Topics
When Exactly Are Onsaveinstancestate() and Onrestoreinstancestate() Called
Android Sdk: Get Raw Preview Camera Image Without Displaying It
How to Capture Image from Custom Cameraview in Android
How to Change Viewpager's Page
What Should Be the Package Name of Android App
Phonegap Plugin:How to Convert Base64 String to a Png Image in Android
Android Google+ Integration - Repeated Userrecoverableauthexception
Error:Execution Failed for Task ':App:Transformclasseswithdexfordebug' in Android Studio
Android String.Xml Reading HTML Tags Problem
Broadcast Receiver Class and Registerreceiver Method
Android: How to Change the Actionbar "Home" Icon to Be Something Other Than the App Icon
Android Button Has Setontouchlistener Called on It But Does Not Override Performclick
Filtering Accelerometer Data Noise
Android: Integer from Xml Resource
How to Use the Android Accelerometer
Android: When Is Oncreateoptionsmenu Called During Activity Lifecycle
Pattern "One Activity, Multiple Views": Advantages and Disadvantages