zoya.
zoya.

Reputation: 51

Titanium android application development

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,,

Upvotes: 1

Views: 2564

Answers (2)

Jason
Jason

Reputation: 88

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.

Upvotes: 2

Xiao
Xiao

Reputation: 108

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

Upvotes: 2

Related Questions