TableViewRow with two lines -- labels overlap

You must Login before you can answer or comment on any questions.

I am trying to display a simple TableView with two lines of text on each row using this code:

var row = Titanium.UI.createTableViewRow({
        height:'auto',
        layout:'vertical'
    });
    var title = Titanium.UI.createLabel({
        text:tableview_rows[i][0],
        textAlign:'left',
        left:0,
        height:'auto',
        width:'auto',
        font:{fontSize:16,fontWeight:'bold'}
    });
    var subtitle = Titanium.UI.createLabel({
        text:tableview_rows[i][1],
        textAlign:'left',
        left:0,
        height:'auto',
        width:'auto',
        font:{fontSize:14}
    });
    row.add(title);
    row.add(subtitle);
    tableview.appendRow(row);
The tableview_rows variable is an array of titles and subtitles declared earlier. Sometimes this code works properly: the title is displayed in bold above the subtitle for each row; this happens on an Ubuntu 9.10 Linux machine and on one Windows XP machine. Other times the title and subtitle overlap on a single line in each row; this happens on a different Windows XP machine.

Both of the machines where it works properly are virtual machines running inside VirtualBox, while the machine where it doesn't work is a physical machine, though I don't see why that should make any difference.

Any thoughts?

2 Answers

You should use on the 2nd label the "top" property

like: top: 50% or top: row.height / 2;

— answered 2 years ago by Alexander Bauer
answer permalink
2 Comments
  • That makes sense but any ideas on why it already displays correctly on some machines without having to set the top property?

    — commented 2 years ago by Peter Donis

  • Also, I just realized that I pasted in an older version of the code; I just corrected it so each of the label constructors have height:'auto' instead of height:'50%'. The symptoms I described are for height:'auto'.

    — commented 2 years ago by Peter Donis

Your Answer

Think you can help? Login to answer this question!