BackgroundImage not shown in TextArea

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

Hi!

I'm trying to display a background image in a TextArea an iPhone, but the image is not shown. I tried to set the image as background for the window and it works, so the image url and the image itself is clearly sane.

var notesTextArea = Ti.UI.createTextArea({
    backgroundColor : '#f0f0f0',
    backgroundImage : 'Images/Backgrounds/background.notes.empty.png',
    value : 'Test'
});
The background color is correctly shown, the 'Test' string as well.

I'm aware of the problem with the url case-sensitivity of the iOS devices, but as I'm trying this currently on iPhone Simulator (iOS 5.0 / no Retina), this can't be the cause.

The image exists in 320x367 pixels and 640x734 pixels (@2x).

SDK version is 1.7.5

Any ideas?

Thanks in advance!

Chris

3 Answers

It Works! You just need to set the backgroundColor:'transparent' for the backgroundImage to be displayed!

— answered 1 year ago by Joseph Sachs
answer permalink
1 Comment
  • woww super that works, I too face the same problem and resolved by the above answer, thanks.

    — commented 1 year ago by prashanth ns

I'm having the same issue. It doesn't look like TextArea honors the backgroundImage property. My current workaround is to create a view with a background image and then add the TextArea to the view:

var textAreaWrap = Ti.UI.createView({
    backgroundImage:'/path/to/image.png'
});
var myTextArea = Ti.UI.createTextArea({
    background:'transparent'
});
textAreaWrap.add(myTextArea);
You'll have to finesse the dimensions of the TextArea so it fits inside the view, and potentially turn off any default styles on the TextArea.

Your Answer

Think you can help? Login to answer this question!