GitHub Issue | n/a |
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2013-10-10T19:50:46.000+0000 |
Affected Version/s | Release 3.1.0, Release 3.1.1, Release 3.1.2 |
Fix Version/s | 2013 Sprint 21, 2013 Sprint 21 API, Release 3.2.0 |
Components | Android |
Labels | module_scrollView, parity, qe-3.1.2, qe-testadded |
Reporter | Federico Casali |
Assignee | Sunila |
Created | 2013-08-01T00:27:36.000+0000 |
Updated | 2014-04-21T10:10:09.000+0000 |
Problem description
imageViews in a scrollView are not correctly resized on Android devices
Sample code
var win = Ti.UI.createWindow({
title:'test',
backgroundColor:'black'
});
var image = Ti.UI.createImageView({
image:'apoc.jpg',
top:5,
width:'95%'
});
var scrollview = Ti.UI.createScrollView();
scrollview.add(image);
win.add(scrollview);
win.open();
(apoc.jpg attached to the project).
Steps to reproduce
Run the sample code using the attached image (image is bigger than the screen)
Result: on Android device the 95% value for the width is respected, but the image is cropped instead of being correctly resized (as is correctly displayed on iOS).
If the image is added to a normal view, is displayed correctly.
Same behavior is reproducible on 3.1.1 GA and 3.1.0 GA, so is not a regression.
Looks like the code was introduced as part of TIMOB-10358 but there was no mention of why this code was introduced. The tests in TIMOB-10358 also runs fine with this change. https://github.com/appcelerator/titanium_mobile/pull/4753
The scaling is disabled if the image view is in a scrollview. The scrollview can extend beyond the screen size, so the image view can extend beyond the screen size. Therefore if the image is larger than the screen size, we don't want to scale it to fit inside the screen. The above PR will introduce a regression. Run the test case attached below and see the regression introduced by this PR:
Updated the pull request with changes to address the scrollview issue
Verified the fix. The image is resized as expected. Thus closing. Environment: Appcel Studio : 3.2.0.201310221639 Ti SDK : 3.2.0.v20131022050844 Device: Samsung Galaxy S4 running android 4.2.2 CLI - 3.2.0 with hash 72f7426b4ee6c2d2883c666d5b7e03906a16012f