[TIMOB-14395] Android: ImageView scaling not consistent with samples in documentation
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2013-10-13T20:45:11.000+0000 |
Affected Version/s | n/a |
Fix Version/s | 2013 Sprint 21, 2013 Sprint 21 API, Release 3.2.0 |
Components | Android |
Labels | n/a |
Reporter | Ben Sudbury |
Assignee | Sunila |
Created | 2013-06-19T00:11:29.000+0000 |
Updated | 2014-10-24T17:01:05.000+0000 |
Description
The following code was used in the documentation for ImageViews for the latest SDK see: [Images and ImageView API's](http://docs.appcelerator.com/titanium/latest/#!/guide/Images_and_ImageView_APIs)
var win1 = Titanium.UI.createWindow({
backgroundColor:'#fff'
});
var imageView = Titanium.UI.createImageView({
image:"/iphone/appicon.png",
width: 57,
height: 100,
backgroundColor: "red"
})
win1.add(imageView);
win1.open();
The code is expected to output a result that looks like this:
!http://docs.appcelerator.com/titanium/latest/images/download/attachments/29004912/imagescaling.png!
Instead, it outputs this:
!SkewedImage.png!
Attachments
File | Date | Size |
---|---|---|
NotEnlarged.png | 2013-06-19T00:20:50.000+0000 | 22734 |
SkewedImage.png | 2013-06-19T00:11:29.000+0000 | 27563 |
A slightly different example but also not scaling as per the documentation. If you change the Width to be larger than the image and the Height to be Ti.UI.SIZE, the image is not scaled up at all. So, the following code:
Results in the following output: !NotEnlarged.png! Note: That scaling is working perfectly for width equal to or less than true image width and Height = Ti.UI.SIZE
Thanks Ben, tested and confirmed on 3.1.1GA & 3.1.0GA, bug occurs on both iOS and Android. Since this ticket has a better test case (as in in classic Titanium) I will move this to engineering and mark other as duplicate. Thanks again for bringing this to our attention. Regards, Carter
This is a pretty serious bug for folks displaying images in their apps. We've had to resort to showing images in webViews which is a much more costly alternative. This is preventing us from migrating to 3.1 for some of our apps.
[~jfalcone] I've tentatively scheduled this for 3.2.0
The test case is working correctly. If both width and height is defined, the image will scale to fill the area without maintaining the aspect ratio. The documentation is not correct. The test case in the comment should make the image scale keeping the aspect ratio intact and keeping the width. Code change fix this issue https://github.com/appcelerator/titanium_mobile/pull/4738
CR + FR