Titanium Community Questions & Answer Archive

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

Nested opacity

I have a view which has opacity 0.5 applied for a background effect, but in there are two labels with text which should NOT want to inherit the opacity (value should be 1).

Is there a way to achieve this or do nested elements automatically receive their parents' opacity properties without the option over overriding?

Thanks

— asked July 8th 2010 by HOWEST *
  • labels
  • nesting
  • opacity
  • views
0 Comments

3 Answers

  • I had a problem with background opacity (In my case I wanted to disable the buttons behind a view), I ended with a background image png slightly transparent to look like the opacity effect. This way in your case I think you could keep your labels at opacity 1.

    Good Luck ;)

    — answered July 8th 2010 by clem chaz
    permalink
    0 Comments
  • You'd need to override the opacity if you don't want it inherited.

    — answered July 8th 2010 by David Ashwood
    permalink
    0 Comments
  • Hmmm Bizarre I do overwrite it:

    var textContainer = Ti.UI.createView({
    width: 200,
    height:'auto',
    backgroundColor: '#000',
    opacity: 0.5,
    right: 0
    });

    textContainer.add(Ti.UI.createLabel({
    text: 'My text in this label',
    color: '#FFF',
    height:'auto',
    opacity: 1,
    font: {fontSize:20, fontFamily: 'Georgia'},
    top: 10,
    left: 10
    }));

    Am I doing something wrong? Or is clem clem's solution the only way out here?

    Thanks!

    — answered July 8th 2010 by HOWEST *
    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.