2011-04-29 176 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