Titanium Community Questions & Answer Archive

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

How to vertically align labels

Is there a way to vertically align labels? I understand that you can use height: 'auto' to make the height auto adjust to the size of the label. This would great except that I need the height of the label to be a certain value. So I figure I have to options. Set the height to 'auto' and somehow make it have a maximum height OR somehow vertically align the text to top. Is this possible and if so how?

— asked June 8th 2010 by Tyler Johnson
  • align
  • auto
  • height
  • iphone
  • label
  • maximum
  • mobile
  • top
  • vertical
0 Comments

2 Answers

  • Accepted Answer

    I would try adding the label to a container view and position the label at top:0 and left:0, then make the container view your desired "maximum size" - I think that would achieve the results you're looking for.

    — answered June 8th 2010 by Kevin Whinnery
    permalink
    0 Comments
  • Hi,

    Not sure if im missing something here.. But have you tried using the top atribute?

    I.E

    label.createLabel({
          height: 'auto',
          top: 110
    });
    
    — answered June 8th 2010 by Scott Robinson
    permalink
    1 Comment
    • Ya I currently use this but the problem is that as the label gets more content the height will auto adjust down which is fine but I need it to max out at around 80 pixels if that makes sense.

      — commented June 8th 2010 by Tyler Johnson
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.