[TIMOB-12430] Android images at multiple resolutions are selected in wrong order
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Needs more info |
Resolution Date | 2013-02-02T01:52:26.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | android, image, resolution |
Reporter | Esben Maaløe |
Assignee | Eduardo Gomez |
Created | 2012-08-14T09:00:10.000+0000 |
Updated | 2017-03-16T20:41:40.000+0000 |
Description
If you have the following images:
Resources/images/test.png
Resources/android/images/test.png
Resources/android/images/res-notlong-port-mdpi/test.png
and somewhere in your code you assign:
backgroundImage : '/images/test.png'
and run it on a res-notlong-port-mdpi device (the emulator at 320x480 is such a device) it would be natural if:
DESIRED BEHAVIOUR
================
The image selected was the one from the specific platform and resolution (Resources/android/images/res-notlong-port-mdpi/test.png)
If no platform/resolution specific image is found - look for a platform specific: (Resources/android/images/test.png)
If no platform specific image is found, look for the generic image (Resources/images/test.png)
Instead you get this:
ACTUAL BEHAVIOUR
================
Is there a generic image (Resources/images/test.png) ?
If so use it, and abort further search!
CONCLUSION
==========
The system ends up preferring images that was NOT meant for the particular device, even though better images are present, meaning you have to code around it and have an elaborate "which platform and resolution" logic in the appcode.
It is the exact same reversal of logic with 9-patch images. if you have test.png and test.9.png - Ti will always use test.png.
I don't seem to be able to reproduce the issue. Which version of Studio are you using? I tested with Studio 2.1.2 and SDK 2.1.2 and looked to be correct. Let me know! Thanks.
Hi Davide, Dang, I forgot to include that info, sry. It must have been the 2.1.1/2.1.1 combo, but I'm not sure (you can check the date of my submission) this test is on 2.1.2/2.1.2 UBUNTU Linux Something seems to have changed. As far as I can see, imageViews do it right in 2.1.2, but the buttonview does not! (urging you to test imageViews anyway, I did not test in depth) I've made at test-case here: http://dl.dropbox.com/u/776614/imagetest.zip Here's the test when I run it: Run in emulator Android HVGA ==================== Two buttons with diff. text is shown. The text is graphical, not a result of the title attrib. Desired result: top button: "9p resolution" bottom button: "Test resolution" 1. Run as is: result: top : "Not button.9.png" FAIL bottom : "Test Android" FAIL 2. delete (rename) '/images/button.png' and '/images/test.png' clean project run again result top : "9p resolution" SUCCESS bottom text : "Test Android" FAIL 3. delete (rename) '/images/android/res-notlong-port-mdpi/button.9.png' and '/images/android/test.png' clean project run again desired result: top : "9p android" bottom text : "Test Resolution" result top : "9p resolution" SUCCESS bottom text : "Test Android" SUCCESS
Dang - that very last line should've been bottom text : "Test Resolution" SUCCESS
Btw - test 1 "run as is" is the one that should be successful on both images.
Hello Esben, I attempted to run the sample attached. However the 9 patch image is malformed.
i.e. console logs
Would it work from another working sample in order to replicate what you are seeing?
Closing due to inactivity. I'd reopen when resources are available in order to replicate what you are seeing.
Closing ticket as the information that was requested was never provided.