[TIMOB-9575] Android: Default (horizontalWrap=true) horizontal layout centers children within rows
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-06-18T15:05:40.000+0000 |
Affected Version/s | Release 2.0.1 |
Fix Version/s | Release 2.1.0, Sprint 2012-12 Core |
Components | Android |
Labels | core, module_views, qe-testadded |
Reporter | Max Stepanov |
Assignee | Allen Yeung |
Created | 2012-06-15T11:56:04.000+0000 |
Updated | 2012-07-13T13:45:51.000+0000 |
Description
var Window = Ti.UI.createWindow({ fullscreen: true, backgroundColor: 'white'});
var ParentView = Ti.UI.createView({backgroundColor:'red',layout:'horizontal', width: Ti.UI.SIZE, height:300})
var ChildView =Ti.UI.createView({backgroundColor:'green',layout:'horizontal', height:200, width: Ti.UI.FILL });
var View =Ti.UI.createView({backgroundColor:'blue',height:120, width:50 });
var View2 =Ti.UI.createView({backgroundColor:'yellow',height:120, width:50 });
ChildView.add(View);
ChildView.add(View2);
ParentView.add(ChildView);
Window.add(ParentView);
Window.open();
*Expected:*
See iOS/MobileWeb snapshots
*Actual:*
See Android snapshot
Attachments
File | Date | Size |
---|---|---|
Android vs. iOS.jpg | 2012-06-15T11:56:05.000+0000 | 62030 |
MobileWeb.jpg | 2012-06-15T11:56:05.000+0000 | 22236 |
This will be resolved as a part of https://github.com/appcelerator/titanium_mobile/pull/2368
The child views here have no top or bottom pins, so previous Android behavior seems correct, and the iOS/Mobile Web behavior is inconsistent with the way we handle positioning in normal views. Given the Android behavior, it's trivial to achieve top positioning (set top = 0 on the child views), but given the iOS/Mobile Web behavior, I don't see an easy way to achieve the centered positioning.
FWIW, we actually center the views like we do in android here when horizontalWrap is set to false.
Verified to be fixed by PR 2368
Verified fix with Titanium Studio, build: 2.1.0.201206221045 Titanium SDK: 2.1.0.v20120622174154 Device: Nexus S 4.0.4