Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-10003

Android: Ti.UI.SIZE does not work well with nested views

    Details

      Description

      The problem

      It seems that view component does not size itself well when nested views are present. To see this issue, run this example:

      (function() {
      	
          var win = Ti.UI.createWindow({ navBarHidden: true, backgroundColor: '#999' });
          
          var parentView = Ti.UI.createView({
          	backgroundColor: '#000',
          	width: Ti.UI.FILL,
          	height: Ti.UI.SIZE,
          	backgroundColor: '#f00'
          });
          
          function createContent() {
          	
          	var view = Ti.UI.createView({
          		top: 0,
          		layout: 'horizontal',
          		width: Ti.UI.FILL,
          		height: Ti.UI.SIZE,
          		backgroundColor: '#0f0'
          	});
          	
          	var header = Ti.UI.createView({
          		width: '90%',
          		height: '75dp',
          		backgroundColor: '#00f'
          	});
          	
          	var label = Ti.UI.createLabel({
          		top: 0,
          		height: '75dp',
          		width: '50%',
          		text: 'Testing ...'
          	});
          	
          	var active = Ti.UI.createSwitch({
          		top: 0,
          		style: Ti.UI.Android.SWITCH_STYLE_CHECKBOX
          	});
          	
          	header.add(label);
          	header.add(active);
          	
          	view.add(header);
          	
          	return view;
          }
          
          for (var i = 0; i < 3; ++i) {
          	parentView.add(createContent());
          }
          
          win.add(parentView);
          
          
          win.open();
       
      })();
      

      You should see only one nested view (one label and one switch).

      Expected behavior

      "parentView" should size itself according to the size of its content. So, all three child views should be visible (and not only one).
      This works fine on iOS.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ayeung Allen Yeung
                Reporter:
                ivan.skugor Ivan Skugor
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-5407
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Source Code