2014-04-08 127 views
0

我是鈦合金新手,我想放置一個抽屜工具,但不顯示工具。 Soemeone告訴我爲什麼和解決方案?謝謝。抽屜部件鈦合金

這裏是我的課:

INDEX.XML

<Alloy> 
    <Window class="container"> 
     <Require type="widget" src="com.appcelerator.drawer" id="drawer" /> 
    </Window> 
</Alloy> 

這是德JavaScript類。

index.js

var principal = Ti.UI.createWindow({ 
    fullscreen : true, 
    navBarHidden : true 
}); 

var boton1 = Ti.UI.createButton({ 
    zIndex : 0, 
    width : "33%", 

    height : "50%", 
    top : 0, 
    left : 0 
}); 
var boton2 = Ti.UI.createButton({ 
    zIndex : 0, 
    width : "34%", 
    height : "50%", 
    top : 0, 
    center : true 
}); 

var boton3 = Ti.UI.createButton({ 
    zIndex : 0, 
    width : "33%", 
    height : "50%", 
    top : 0, 
    right : 0 
}); 

principal.add(boton1); 
principal.add(boton2); 
principal.add(boton3); 

$.drawer.init({ 
    mainWindow : principal, 
    buttons : [{ 
     id : 'One', 
     title : 'One', 
     backgroundcolor : "white", 
     click : function(e) { 
      alert("One"); 
     } 
    }], 
    gutter : 5, 
    overrideMenu : true 
}); 

principal.open(); 

回答

0

其實你在另一個窗口小部件添加和你逝去的另一個窗口對象index.js文件,所以只能使用一個窗口。

INDEX.XML

<Alloy> 
    <Window class="container" id="principal"> 
     <Require type="widget" src="com.appcelerator.drawer" id="drawer" /> 
    </Window> 
</Alloy> 

index.js

$.drawer.init({ 
    mainWindow : $.principal, 
    buttons : [{ 
     id : 'One', 
     title : 'One', 
     backgroundcolor : "white", 
     click : function(e) { 
      alert("One"); 
     } 
    }], 
    gutter : 5, 
    overrideMenu : true 
}); 

$.principal.open(); 
+0

它的工作原理!謝謝! – CandelSR