Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16240] Android: Images smaller than expected for Buttons, Menu Icons, Map Pins

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2014-12-01T21:50:25.000+0000
Affected Version/sn/a
Fix Version/sRelease 4.0.0
ComponentsAndroid
Labelsexalture, merge-3.5.0
ReporterDavid Bankier
AssigneeSunila
Created2014-01-16T10:36:07.000+0000
Updated2015-02-13T01:09:25.000+0000

Description

For Buttons, ActionBar Menu Icons, Map pins, etc (excluding ImageView) depending on the location of the source image, the images are sometimes smaller than expected. See the following comment for the full details, sample code to tests, assets and screenshots. https://github.com/dbankier/TiShadow/issues/180#issuecomment-32426567 (Please Note: even though the issue is raised in the TiShadow repository the comment _only_ refers to direct usage of Titanium without TiShadow.)

Comments

  1. Ryan Gartin 2014-01-17

    Seeing it in the ActionBar and in TableViewRow::rightImage as well.
  2. Chris Apers 2014-02-03

    I can also confirm this issue. It can be easily reproduced using a base64 image at the expected size. For instance, on my FullHD device, a 48dp icon should be 144px. Using this image in a ImageView shows an image correctly sized. Half-sized in the action bar.
       var blob = Ti.Utils.base64decode("SOME BASE64 ENCODED IMAGE DATA");
       
       Ti.UI.createImageView({ image: blob }); // Correct size
       
       
       var file = Ti.Filesystem.getFile(Ti.Filesystem.tempDirectory, "image.png");
       var res = file.write(img);
       var location = file.resolve();
       
       ...
       
       // Image will be too small (half-sized)
       menu.add({
           title : "Cart",
           icon  : location,
           showAsAction : Ti.Android.SHOW_AS_ACTION_ALWAYS
       });
       
       
  3. Sunila 2014-09-28

    Scale the image based on device density if it is not loaded from resource https://github.com/appcelerator/titanium_mobile/pull/6177
  4. Mark Mokryn 2014-11-08

  5. Satyam Sekhri 2014-11-28

    The issue is marked fix version 3.5.0, but the fix does not work on the latest CI build from 3_5_X branch. However, the issue is fixed in the master branch for appropriately scaled images on button and action bar. Re-opening as it is not fixed in 3_5_X branch. Verified on: SDK: 3.5.0.v20141125154115, 3.6.0.v20141125154117(master) Studio: 3.4.1.201410281743 CLI: 3.4.1 Alloy: 1.5.1 Device: Nexus 5 (4.4.4), Nexus 4 (4.4.4)
  6. Mark Mokryn 2014-11-28

    There is also no reason to not port this to 3_4_X - I already did that in my fork and it works fine.
  7. Ingo Muschenetz 2014-12-01

    Fixed, but needs backport.
  8. Ewan Harris 2015-02-13

    Verified fix on: Mac OSX 10.10.2 Appcelerator Studio, build: 4.0.0.201502051633 Titanium SDK build: 4.0.0.v20150212161920 Titanium CLI, build: 3.6.0-dev Alloy: 1.6.0-alpha Android Build tools 21.1.2 Nexus 6 (5.0.1), Galaxy S3(4.4.2) Built to both devices, the images are appropriately scaled. Closing ticket.

JSON Source