Titanium Community Questions & Answer Archive

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

TableViewRow height:'auto' ignores padding values.

There seems to be something wrong in the calculation of a tableview's row height when using an additional padding for a label (at least on android).
It seems the padding (top and bottom values) is ignored when when using height:'auto'. Thus text gets cut off at the bottom.

You can see this behaviour in the KitchenSink example 'table_view_auto_height.js'. All code samples below are taken directly from this file.

The auto height TableViewRow is created like this:

data[0] = Ti.UI.createTableViewRow({hasChild:true,height:'auto'});

The auto height text label is added like this:


But the resulting TableViewRow with label gets cut off at the bottom by 20 pixels… is this really desired behaviour?
When setting the labels top and bottom values to 0 (or using a fixed height) the label gets displayed correctly.

Using the toImage() method to calculate the labels actual height as Ryan proposed here, then adding the desired padding value seems a bit over-the-top.

Any other known workarounds?

— asked June 3rd 2010 by Friedrich Seydel
  • android
  • auto
  • height

0 Answers

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.