Titanium Community Questions & Answer Archive

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

Tableview Row Colors and Transparent Table Backgrounds

Just noticed a simple bug / oversight:

I'm trying to imitate a table view that has no background after the last row so the window background is shown. Here's one such example: http://www.momentoapp.com/images/screenshots/tags.jpg

It sounds simple but there's a couple boogers in there. If you set the tableview background to nothing, it will show through but the the row separators repeat until it reaches the edge of the window (see: http://screencast.com/t/NTg2NjdmZWU). Obviously I could set a fixed height to the table but that's not good because there might be more rows depending on the data.

So I set the tableview to have transparent BG AND separator:
backgroundColor: 'transparent',
separatorColor: 'transparent'

And then added a view to each row that draws a line all the way across.

Which works. Here is the result:
http://screencast.com/t/NTczYTljO

Although that works, It would be cool if I could set the table ROW with a specific separatorColor but that property doesn't work or doesn't exist for the tableViewRow. This would be a lot better than drawing a line across I would think, for resource sake.

Is there another way to do it that I'm missing perhaps? How would you guys do it?

— asked September 13th 2010 by Rick Blalock
  • background
  • table
  • tableview
  • transparent
0 Comments

2 Answers

  • I've encountered exactly the same problem.

    I 'solved' it in much the same way by adding the separator to the backgroundImage for the row instead of adding another view.

    One alternative might be to use a dynamic table view height, something along the lines of height:(rowHeight * data.length).

    — answered September 14th 2010 by James K
    permalink
    0 Comments
  • Never thought about the dynamic table height! Cool idea.

    — answered September 14th 2010 by Rick Blalock
    permalink
    0 Comments
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.