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: top value


I created a label and gave it "top: 5".

After that i added it to my view and instead of being on the top, it is in the middle of my view.

Now i tested and i i give it "top: -220" it is on the top.

Are the any ways to make this "normal"? (i mean that top 0 is the top of my view?)

— asked June 10th 2010 by Michael Gajda
  • iphone
  • mobile
  • positioning
  • top
  • view
1 Comment
  • I've seen this same issue. Has anyone discovered why it behaves this way?

    — commented October 18th 2010 by DeRon Brown

1 Answer

  • Accepted Answer

    Add these values to your label var:



    — answered November 15th 2010 by Undici Design
    • This the correct reason. You need to specify a height and a width for the label for it not to take up 100% of the area in the parent.

      — commented November 15th 2010 by Kevin Whinnery
    • Thank you so much for this. I pulled out my hair for about an hour (I shave my head) trying to figure out why Android and iOS was giving me different results as to the placement of a label. Android didn't care about the omission of height:'auto', but labels in iOS behave normally now.

      — commented August 13th 2011 by Darren Adams
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.