2011-02-02 19 views
2
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.createView({ 
    backgroundColor:'#1D561C', 
    top:mainWindow.height - 40, 
    height:40 
}) 

我有我的頭文件中定義爲40和頁腳40現在怎麼我到主窗口說,你應該在40 PX開始......當我在x:40定義它頁腳確實消失。通過編程設置我的主窗口的高度在鈦

回答

1

這個怎麼樣?

var mainWindow = Ti.UI.createWindow({ 
    backgroundColor:'#EAE6DB', 
    top:40, 
    bottom: 40, 
    left: 0, 
    right: 0 
}); 

寬度和高度可以判斷基於你想多遠是從邊緣 - 在這種情況下,40從頂部和40從底部。您也可以將相同的邏輯應用於頁腳,而不是計算距離頂端多遠。

另請注意,如果您希望能夠將元素放入特定高度,並讓Titanium計算機從頂部進行偏移,則可以使用Ti.UI.createScrollView({ layout: 'vertical' })

相關問題