[AC-2971] Auto height not working in 2.x (works in 1.8.2)
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2012-04-12T08:32:35.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | ios, layout |
Reporter | Frank Apap |
Assignee | Shak Hossain |
Created | 2012-04-12T07:35:20.000+0000 |
Updated | 2016-03-08T07:47:58.000+0000 |
Description
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();
~~~
Use Ti.UI.SIZE instead of 'auto'. This is a new feature & behavior in 2.x, and is expected.
Ah, that works. Thanks.