开发者

Titanium android application development

开发者 https://www.devze.com 2023-03-15 07:25 出处:网络
I want to ask about the image view in titanium android development because i am not getting the right way to create a image view for my application. i have taken a window and on that i added a view wi

I want to ask about the image view in titanium android development because i am not getting the right way to create a image view for my application. i have taken a window and on that i added a view with black background color and on 开发者_高级运维this i want to add an image ,,at a set position but i m unable to used it....

/////here is my code//// // Add Visitor Screen by vishakha

var win1 = Titanium.UI.createWindow({
    backgroundColor:'white', height:480, width:320
}); 
win1.open(); 
var header= Titanium.UI.createView({
    backgroundColor: 'black', 
    top: 0, left:0, 
    height:65, width:320
}); 
win1.add(header);
var backbutton= Titanium.UI.createImageView({
    backgroundImage:'images/back.png',
    height: 40,
    top:5,
    left:5,
    width:50
}); 
header.add(backbutton);

but this image is not shown... n 1 thing more i put the image in resource folder... please help me ..,,hope for a example.. thanks,,


Have you tried using the 'image' property instead of 'backgroundImage?'


Instead of using:

var backbutton= Titanium.UI.createImageView({
    backgroundImage:'images/back.png',
    height: 40,
    top:5,
    left:5,
    width:50
}); 

Use:

var backbutton= Titanium.UI.createImageView({
    image:'/back.png',
    height: 40,
    top:5,
    left:5,
    width:50
}); 

That is assuming your image file is in the Resources folder. For creating an ImageView, you want to use image instead of backgroundImage.

0

精彩评论

暂无评论...
验证码 换一张
取 消