backgroundImage for view not working in android

You must Login before you can answer or comment on any questions.

heres my code

var view1 = Ti.UI.createView({
        backgroundImage:'C:\Documents and Settings\hamza\My Documents\sd.png',  
    });

— asked 10 months ago by hamza rauf
2 Comments
  • i've also tried storing pic in resources ans giving its path...

    — commented 10 months ago by hamza rauf

  • Hi Hamza,

    It's because your folder name consist space in between try to remove space from folder name in which you put your image.

    — commented 10 months ago by Nitin Chavda

3 Answers

Put the Image in the Resources folder of the Project and give that Url...

Example: var view1 = Ti.UI.createView({ backgroundImage:'sd.png',
});

Hi Hamza,

As Suresh kumar suggested place the image in resources folder. Also mention the width and height of the view.

thanks but what worked for me was to put the image in resources/ui/common and i gave a url of
~~~ backgroundImage:'./image.png', ~~~

Your Answer

Think you can help? Login to answer this question!