Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9575] Android: Default (horizontalWrap=true) horizontal layout centers children within rows

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-06-18T15:05:40.000+0000
Affected Version/sRelease 2.0.1
Fix Version/sRelease 2.1.0, Sprint 2012-12 Core
ComponentsAndroid
Labelscore, module_views, qe-testadded
ReporterMax Stepanov
AssigneeAllen Yeung
Created2012-06-15T11:56:04.000+0000
Updated2012-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

FileDateSize
Android vs. iOS.jpg2012-06-15T11:56:05.000+000062030
MobileWeb.jpg2012-06-15T11:56:05.000+000022236

Comments

  1. Allen Yeung 2012-06-17

    This will be resolved as a part of https://github.com/appcelerator/titanium_mobile/pull/2368
  2. Arthur Evans 2012-06-18

    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.
  3. Allen Yeung 2012-06-18

    FWIW, we actually center the views like we do in android here when horizontalWrap is set to false.
  4. Max Stepanov 2012-06-18

    Verified to be fixed by PR 2368
  5. Olga Romero 2012-06-23

    Verified fix with Titanium Studio, build: 2.1.0.201206221045 Titanium SDK: 2.1.0.v20120622174154 Device: Nexus S 4.0.4

JSON Source