Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Images aren't showing up. They just appear black

This is the code for my app:

// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');

// Home window
var win1=Titanium.UI.createWindow({
image:'images/mainpage-bg.png'
});

var btn=Titanium.UI.createButton({
backgroundImage:"images/Twitter.png",
width:60,
height:60
});

btn.addEventListener("click",function(e){
alert(e.source + "was clicked");
});

win1.open();

win1.add(btn);

It is a simple window(supposed to have a background) with a button that is also supposed to have a background. But there is nothing.

Any help would be greatly appreciated!

— asked July 7th 2010 by Lauren R
  • background
  • image
  • iphone
  • window
0 Comments

1 Answer

  • use backgroundImage for the window and follow the button skinning examples from the Kitchen Sink demo app for more guidance on how to use custom images.

    — answered July 7th 2010 by Kevin Whinnery
    permalink
    2 Comments
    • I changed it to backgroundImage. Nothing occurred:/

      — commented July 7th 2010 by Lauren R
    • Have you figured this out? I've run into the same issue. Setting a background color or image always defaults to black…

      — commented October 8th 2010 by Joe Irvine
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.