[TIMOB-15525] Android: Setting left + right doesn't limit width when set/left to Ti.UI.SIZE
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2013-10-24T00:18:18.000+0000 |
Affected Version/s | n/a |
Fix Version/s | 2013 Sprint 22, 2013 Sprint 22 Core, Release 3.2.0 |
Components | Android |
Labels | android, module_android, parity, qe-manualtest, qe-testadded, regression, width |
Reporter | Fokke Zandbergen |
Assignee | Allen Yeung |
Created | 2013-10-17T13:32:58.000+0000 |
Updated | 2014-11-19T21:28:25.000+0000 |
Description
On iOS, setting view A's
left
+ right
and leaving/setting width
to Ti.UI.SIZE
will result in the width of A's parent, minus A's left
+ right
, being used as a maximum for A's effective width.
On Android, the result will be as if only left
was set and the view A will be as long as it needs to be for its content, until it hits A's parent width.
See the screenshots for the difference with the following code:
var win = Titanium.UI.createWindow({
backgroundColor:'#fff'
});
var view = Ti.UI.createView({
top: 0,
width: 300,
backgroundColor: '#ccc'
});
view.add(Ti.UI.createLabel({
width: 200,
height: 20, // Force ellipsize on iOS
wordWrap: false,
ellipsize: true,
top: 100,
text: 'WIDTH, WIDTH, WIDTH, WIDTH, WIDTH, WIDTH, WIDTH',
backgroundColor: 'red',
color: 'white'
}));
view.add(Ti.UI.createLabel({
left: 50,
right: 50,
height: 20, // Force ellipsize on iOS
wordWrap: false,
ellipsize: true,
top: 200,
text: 'LEFT + RIGHT, LEFT + RIGHT, LEFT + RIGHT, LEFT + RIGHT',
backgroundColor: 'green',
color: 'white'
}));
view.add(Ti.UI.createLabel({
left: 50,
width: Ti.UI.FILL,
right: 50,
height: 20, // Force ellipsize on iOS
wordWrap: false,
ellipsize: true,
top: 300,
text: 'LEFT + FILL + RIGHT, LEFT + FILL + RIGHT, LEFT + FILL + RIGHT',
backgroundColor: 'blue',
color: 'white'
}));
view.add(Ti.UI.createLabel({
left: 50,
width: Ti.UI.SIZE,
right: 50,
height: 20, // Force ellipsize on iOS
wordWrap: false,
ellipsize: true,
top: 400,
text: 'LEFT + SIZE + RIGHT, LEFT + SIZE + RIGHT, LEFT + SIZE + RIGHT',
backgroundColor: 'yellow',
color: 'black'
}));
win.add(view);
win.open();
Attachments
File | Date | Size |
---|---|---|
device-2013-10-17-153212.png | 2013-10-17T13:32:58.000+0000 | 21206 |
iOS Simulator Screen shot 17 okt. 2013 15.32.04.png | 2013-10-17T13:32:58.000+0000 | 11311 |
This does not occur in 3.0.2 and below, So it would seem that it is a regression occuring in 3.1.0
https://github.com/appcelerator/titanium_mobile/pull/4828
Works as expected so closing the issue. Verified fix on: Device : HTC desire V , Android version : 4.0.3 SDK: 3.2.0.v20131023222443 CLI version : 3.2.0 OS : MAC OSX 10.8.4 Alloy : 1.2.2 Appcelerator Studio, build: 3.2.0.201310181700 XCode : 5