var headerView = Ti.UI.createView({
backgroundColor:'#1D561C',
top:0,
height:40
})
var mainWindow = Ti.UI.createWindow({
backgroundColor:'#EAE6DB',
top:0,
x: 40,
height: 'auto',
height:Titanium.Platform.displayCaps.platformHeight,
})
var footerView = Ti.UI.createVi开发者_StackOverflowew({
backgroundColor:'#1D561C',
top:mainWindow.height - 40,
height:40
})
I have my header defined as 40 and footer as 40. Now how to i say to main window that you should start after 40 px... when i define it in x:40
the footer does get disappear.
How about this?
var mainWindow = Ti.UI.createWindow({
backgroundColor:'#EAE6DB',
top:40,
bottom: 40,
left: 0,
right: 0
});
The width and height can be determined based on how far you want to be from the edges -- in this case, 40 from the top, and 40 from the bottom. You could also apply the same logic to the footer, instead of calculating how far from the top to place it.
Also note that you could use Ti.UI.createScrollView({ layout: 'vertical' }) if you want to be able to throw elements in with particular heights, and let Titanium computer their offsets from the top.
精彩评论