Titanium Community Questions & Answer Archive

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

Label over Image

I'm trying to put a Label over createImageView(), but doesn't work, the Image always appear over the Label, already try with zIndex but don't work too. Any ideas ?

The code:

var gallImg = Ti.UI.createImageView({
    url: photos[i].thumb,
    width:210,
    height:140,
    zIndex: -1
});

var title = Titanium.UI.createLabel({
    text: photos[i].title + ' (' + photos[i].publish + ')',
    backgroundColor: '#000000',
    width:210,
    height:50,
    bottom: 'bottom',
    color:'#ffffff',
    textAlign:'left',
    zIndex: 5
});

gallImg.add(title);

Also doesn't work when adding a ImageView() over another ImageView()

Thanks in advanced

— asked July 12th 2010 by Esteban Fernandez
  • image
  • imageview
  • label
0 Comments

2 Answers

  • Accepted Answer

    You are adding a label to an image, is not good

    create a "view", add the image to the view, add the label to the view.

    — answered July 12th 2010 by Dan Tamas
    permalink
    0 Comments
  • wait….

    if you have a view or window… create and add the imageView to it first, then create and add the label (to the view or window, not the image view) and you should be fine…. all without any need for zIndex

    — answered July 12th 2010 by Stephen Gilboy
    permalink
    1 Comment
    • Of course I'm doing that, doesn't work.

      — commented July 12th 2010 by Esteban Fernandez
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.