2011-04-29 127 views
0

我有一個問題,我歸結背面的圖像按鈕沒有出現我加了這個說法,但它確實沒有什麼的BackgroundImage問題

win1.setBackButtonTitleImage('back.png'); 

這裏是代碼

var ButtonRetour = Ti.UI.createButtonBar({labels:['Retour'], 
              backgroundColor:'#ae4041', 
              backgroundImage:'back.png', 
              color:'#ffffff' });    
ButtonRetour.addEventListener('click', 
           function(){ tabGroup.close(); }); 

win1.leftNavButton = ButtonRetour; 
win1.setBackButtonTitleImage('back.png'); 

你有一個關於這個問題的想法

謝謝

我找到了解決方案

我用下面

var backButton = Ti.UI.createButton({ 
    title:'Accueil', 
    backgroundImage:'images/back.png', 
    font:{fontSize:13,fontWeight:'bold'}, 
    textAlign:'center', 
    width:75, 
    height: 35  
});    

backButton.addEventListener('click', function(){ 
    tabGroup.close(); 
}); 

win1.leftNavButton = backButton; 

回答

0

嘗試,實際上改變了代碼爲創建後退按鈕。請注意,我不知道您是否可以使用這兩種backgroundColorbackgroundImage

var ButtonRetour = Titanium.UI.createButton({ 
        title:'Retour', 
        backgroundColor: '#ae4041', // i am not sure whether you can use both bgColor and bgImage 
     backgroundImage:'back.png', 
     width:100, //set proper width here 
     height:20 //set proper height here 
    }); 
    ButtonRetour.addEventListener('click', function() { 
     tabGroup.close(); 
    }); 
    win1.leftNavButton = ButtonRetour; 
+0

感謝您的回覆,但即使禁用backroundColor它不工作,然後我增加了高度和寬度屬性,它什麼都不做。 知道圖像和我的應用程序的根 – Sabrina 2011-04-29 10:24:51

+0

這可能是重點,將其放置在資源/圖像目錄,然後將其引用爲'var image = Ti.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory, 'images/back.png');' – knuku 2011-04-29 10:51:01

+0

是的,我嘗試將圖像放在圖像文件夾中,但它也不起作用。這有點奇怪 – Sabrina 2011-04-29 11:14:11