Titanium Community Questions & Answer Archive

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

Vertical Layouts


It's been fairly easy to understand and work with the Mobile API so far - good work.

One problem I have now is vertical layouts. My basic layout is:

  • image of set height
  • text of variable height
  • text of variable height

I've tried the recommended solution of using height:'auto' and setting the window layout to 'vertical', but, unless I set absolute positions this does not work.

Is there a 'proper' way of making a layout like this without absolutely positioning the elements?

Thanks in advance

— asked June 15th 2010 by Sean McEmerson
  • auto
  • height
  • layout
  • scrollview
  • vertical

3 Answers

  • make sure everything is set to height:'auto' then position things by their relative top positions (and left or right naturally)

    If you need to place something further up the view, you can also use negative values. (useful if you know the height of an image and want to add the label text after.)

    — answered June 16th 2010 by Kosso
  • Thanks for your reply, Kosso. I was a bit more patient with the examples from Kitchen Sink and I was able to get my layout working - for now!

    Thanks again.

    — answered June 16th 2010 by Sean McEmerson
  • height:'auto' on everything within a layout:'vertical' view/window doesn't work on android.

    Also, if you need to specify the width and height of an image or something within the view, you're screwed.

    If someone has got it working, please post your code.

    There's so many threads on this - it's a major flaw.

    — answered August 10th 2010 by John Kirby
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.