Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9386] Android: Implement conditional horizontal layout wrapping

GitHub Issuen/a
TypeSub-task
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-06-18T14:04:12.000+0000
Affected Version/sRelease 2.1.0
Fix Version/sRelease 2.1.0, Sprint 2012-12 Core
ComponentsAndroid
Labelscore, layout, parity
ReporterMax Stepanov
AssigneeAllen Yeung
Created2012-06-05T13:22:56.000+0000
Updated2017-03-22T00:14:51.000+0000

Description

*horizontalWrap:boolean* property will control warp/no-wrap (default is true) // all color boxes should be contained within one row (no wrapping)
var win = Ti.UI.createWindow({ fullscreen: true, backgroundColor: 'white'});

var parent = Ti.UI.createView({backgroundColor:'red',layout:'horizontal', horizontalWrap: false, width:Ti.UI.SIZE, height:300})

var child1 =Ti.UI.createView({backgroundColor:'green',height:60,width:130});
var child2 =Ti.UI.createView({backgroundColor:'blue',height:120,width:170});
var child3 =Ti.UI.createView({backgroundColor:'#eee',height:120,width:50});
var child4 =Ti.UI.createView({backgroundColor:'#666',height:60,width:50});
 
parent.add(child1);
parent.add(child2);
parent.add(child3);
parent.add(child4);
 
win.add(parent);
win.open();

Attachments

FileDateSize
horizontalTextCases.txt2012-06-15T19:02:43.000+00002463

Comments

  1. Allen Yeung 2012-06-07

    Another test case with wrap enabled:
       var win = Ti.UI.createWindow({ fullscreen: true, backgroundColor: 'white'});
       var parent = Ti.UI.createView({backgroundColor:'red',layout:'horizontal',width:300, height:500})
       var child1 =Ti.UI.createView({backgroundColor:'green',height:60,width:150, bottom: 0});
       var child2 =Ti.UI.createView({backgroundColor:'blue',height:120,width:120});
       var child3 =Ti.UI.createView({backgroundColor:'#eee',height:120,width:150});
       var child4 =Ti.UI.createView({backgroundColor:'#666',height:60,width:150, top: 0});
       var child5 =Ti.UI.createView({backgroundColor:'yellow',height:20,width:150});
       var child6 =Ti.UI.createView({backgroundColor:'purple',height:120,width:150});
        
       parent.add(child1);
       parent.add(child2);
       parent.add(child3);
       parent.add(child4);
       parent.add(child5);
       parent.add(child6);
        
       win.add(parent);
       win.open();
       
  2. Vishal Duggal 2012-06-15

    The above test case is misleading. Green child has bottom pin.
  3. Allen Yeung 2012-06-15

    Removed the incorrect comments in the test case above. The bottom pin should force the green view to anchor to the bottom of that row.
  4. Vishal Duggal 2012-06-15

    I have problems with the test cases attached. Test Case 1 Why would everything come in one row in landscape mode? With only left and right pins defined the green view is essentially following a fill behavior. Wouldn't it always occupy the first row irrespective of the orientation? Test Case 3 // Top + Bottom with undefined height. The height of the green view should be constrained by the maximum height in that row, which is 120. i.e. the green view should not have fill behavior Why is the maximum height of the row 120. The green view is again following FILL behavior. Its height should be parent height - (top+bottom). From the docs in the PR "if both top and bottom are defined they are treated as padding." I am assuming that they are padding from the parent bounds.
  5. Allen Yeung 2012-06-15

    Test Case 1: My mistake, that comment was meant for test case 2. I have moved it accordingly. You are right, the green view should fill the first row regardless of orientation. Test Case 2: The parent view should be wide enough to fit child1- child3 in it. Since child3 has a height of 120, that is the maximum height for that row.
  6. Lee Morris 2017-03-22

    Closing ticket as fixed.

JSON Source