//Create a Ti.UI.View with scroll view and do not put any content
var win = Ti.UI.createWindow();
win.backgroundColor = 'white';
var label = Ti.UI.createLabel({
text: 'View Size is: ',
top: 20,
left: 10,
height: Ti.UI.SIZE,
width: Ti.UI.SIZE,
color: 'black'
});
var scrollView = Titanium.UI.createScrollView({
contentHeight:'50',
contentWidth:'auto',
showVerticalScrollIndicator:true,
showHorizontalScrollIndicator:true
});
var view = Ti.UI.createView();
var view2 = Ti.UI.createView({
backgroundColor:'red'
})
scrollView.add(view2);
win.addEventListener('postlayout', function layoutHandler(e) {
win.removeEventListener('postlayout', layoutHandler);
label.text = 'ScrollView\'s height and width: ' + scrollView.size.height + 'x' + scrollView.size.width + '\n' +
'Screen\'s height and width: ' + win.size.height + 'x' + win.size.width;
win.addEventListener('postlayout', layoutHandler);
});
win.add(scrollView);
win.add(view);
view.add(label);
win.open();
In the code above, the height of view2 should be the size of the scroll view and not 50.
Pull Request: https://github.com/appcelerator/titanium_mobile/pull/2387
Closing ticket as fixed.