I have an app with some images exists only in the xxhdpi
folder. When I try to access to those imagse, through context.getResources(...)
I see in some phones it crash.
is it possible that it crash because those phones doesn't supports the density in xxhdpi and therefore it cannot find them? or even though the phone is not in density for xxhdpi
, it still needs to find it, so it doesn't matter?
In bottom line, my question is what happens if I put some images only in xxhdpi
folder, and the phone doesn't supports by default in xxhdpi
resolution?
是的,它会崩溃,相反,您可以将它们放在 Drawable 的默认文件夹中。
this isn't best solution to MOVE pretty big image file from xxhdpi
to default folder as accepted answer suggests... it will be scalled everytime when it will be fetched, so on xxhdpi
devices it will be scaled-up 3x - unnecessary work. besides that some old devices may have problem with loading such big picture, due to max bitmap size limitation. it would be better to COPY this file to mdpi
folder and rescale it in there (3x smaller) - on xxhdpi
will be used original one, on all other scaled version, but not so enormous
ofc best way is to put properly scaled image in every density bucket
If it is really a big image and you want to use it, then put it in nodpi folder. And if it is a normal image then it is better to scale images with different sizes and put them in a respected folder.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.