Titanium Community Questions & Answer Archive

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

Minimum width for elements?

I want an auto-width label that stretches like a width:'auto' element but also has a minimum width.

Is there any way to declare a minimum width or perhaps a left/right padding in a label?

— asked December 1st 2010 by Ian Maddox
  • label
  • minimum
  • padding
  • width
1 Comment
  • This still doesn't seem to be directly feasible…did you figure out a solution? This would be very handy.

    — commented January 7th 2013 by Senica Gonzalez

1 Answer

  • Ian

    If your goal is to keep it centred and for it to dynamically expand and contract in relation to the orientation, you can leave the width unset, and set the left and right properties to the same value.

    If I've misunderstood, then maybe you mean the spacing between the text and the edge of the label. If this is the case, you would need to add the label to a view, possibly with a fixed width, and set the left and right attributes as above.

    If this wasn't what you were after, then let me know.

    — answered December 1st 2010 by Paul Dowsett
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.