Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-28537

Android: IMAGE_SCALING_AUTO not stretching ImageView if both width/height is set as of 10.1.0

    Details

    • Story Points:
      3
    • Sprint:
      2021 Sprint 20

      Description

      Summary:
      As of 10.1.0, the new ImageView scalingMode property which defaults to Ti.Media.IMAGE_SCALING_AUTO is supposed to stretch the image disproportionally if both the "width" and "height" properties are defined. If only 1 of the "width" or "height" properties are defined (or neither), then it's supposed to do a Ti.Media.IMAGE_SCALING_ASPECT_FIT which is a letterbox scale. This is to match the old scaling behavior before Titanium 10.1.0.

      As of 10.1.0.RC, setting both "width" and "height" with the default Ti.Media.IMAGE_SCALING_AUTO mode no longer stretches the image disproportionally anymore on Android. It's always doing a letterbox scale.

      Steps to reproduce:

      1. Build and run the below on Android.
      2. Notice the image is wrongly scaled proportionally when it should be stretched width-wise.

      const win = Ti.UI.createWindow();
      win.add(Ti.UI.createImageView({
      	image: "https://raw.githubusercontent.com/appcelerator/titanium_mobile/master/templates/app/angular-default/template/DefaultIcon.png",
      	width: Ti.UI.FILL,
      	height: 30,
      }));
      win.open();
      

      Result:
      Notice the image is proportionally scaled to the "height" property's value of 30. This is wrong since both "width" and "height" properties are defined. (The below would only be correct if only the "width" property was defined.)

      Expected Result:
      The image should be stretched as follows.

        Attachments

          Activity

            People

            • Assignee:
              jquick Joshua Quick
              Reporter:
              jquick Joshua Quick
              Reviewer:
              Gary Mathews
            • Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                  Git Integration