[AC-2971] Auto height not working in 2.x (works in 1.8.2)

GitHub Issuen/a
Resolution Date2012-04-12T08:32:35.000+0000
Affected Version/sn/a
Fix Version/sn/a
Labelsios, layout
ReporterFrank Apap
AssigneeShak Hossain


The code below works as expected on 1.8.2 however on 2.0.1.v20120410131722 the body takes up the entire screen (it appears the auto height isn't working correctly). ~~~ // this sets the background color of the master UIView (when there are no windows/tab groups on it) Titanium.UI.setBackgroundColor('#000'); // // create base UI tab and root window // var win1 = Titanium.UI.createWindow({ title:'Tab 1', backgroundColor:'#fff' }); var sView = Ti.UI.createScrollView({ contentWidth:'auto', contentHeight:'auto', top:0, height:400, backgroundColor:'#eef4f6', showVerticalScrollIndicator:true }); var innerView = Ti.UI.createView({ //layout:'vertical', //THIS BREAK SCROLLING - NO IDEA WHY top:0, height:'auto', width:'100%' }); var sidePadding = '10'; var iView = Ti.UI.createView({ layout:'vertical', top:0, left:sidePadding+'dp', right:sidePadding+'dp' }); var top = Ti.UI.createView({ top:0, height:35, width:'100%', backgroundColor:'red' }); var body = Ti.UI.createView({ top:0, backgroundColor:'red', width:'100%', height:'auto', backgroundColor:'yellow' }); var fontSize = 12; var text = Ti.UI.createLabel({ top:'0', color:'black', height:'auto', font:{fontSize:fontSize+'dp'}, textAlign:'left', left:5, right:5, text:"Lorem Ipsmum Lorem IpsmumLorem IpsmumLorem Ipsmum Lorem Ipsmum Lorem IpsmumLorem IpsmumLorem Ipsmum" }) body.add(text); var bot = Ti.UI.createView({ top:0, height:17, width:'100%', backgroundColor:'blue' }); iView.add(top); iView.add(body); iView.add(bot); innerView.add(iView); sView.add(innerView); win1.add(sView); win1.open(); ~~~


  1. Shannon Hicks 2012-04-12 Use Ti.UI.SIZE instead of 'auto'. This is a new feature & behavior in 2.x, and is expected.
  2. Frank Apap 2012-04-12 Ah, that works. Thanks.

JSON Source