Titanium Community Questions & Answer Archive

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

View backgroundImage

For some reason, I can not set a background image for a view? The path is correct and the code is correct. I can load that image using the imageview but the image will not load when using it in a backgroundimage attribute for the view.

I copy the exact code from KitchenSink and change the url but still, it failed.

    var photo = Ti.UI.createView({
        backgroundImage:'../images/custom_tableview/user.png',
        top:5,
        left:10,
        width:50,
        height:50
    });
— asked April 20th 2010 by Hai Nguyen
  • backgroundimage
0 Comments

3 Answers

  • I have sometimes found if I change the path it works fine [follow example below]. No need to move any files, just edit the code:

    '../images/custom_tableview/user.png'

    to

    'images/custom_tableview/user.png'

    — answered April 20th 2010 by Sean DeChellis
    permalink
    0 Comments
  • if you're really pressed put the image in the same directory (yes I know it's not totally cool) and use "user.png"

    — answered April 20th 2010 by Mark Smillie
    permalink
    0 Comments
  • I have the same problem, none of the above solutions work, one of them (put in same) leads to crasch.. =/

    — answered April 14th 2011 by Max Finnsjö
    permalink
    0 Comments
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.