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 borderBottom borderTop?

Hello, is it possible to assign different styles/colors to a TableViewRow bottom/top border? Or should I use a png as a backgroundImage?

— asked September 2nd 2010 by Michael G.
  • border
  • tableviewrow
0 Comments

4 Answers

  • Accepted Answer

    Not possible. Need to use backgroundImage or add an overlapping child view.

    — answered September 2nd 2010 by James K
    permalink
    1 Comment
    • This is 2 years old. Using separatorColor property on TableView works now. See my answer below.

      — commented December 4th 2012 by Bryan Sloan
  • Here's an example of a TableViewRow with a top border, bottom border, and background gradient like this:

    bordered bar

    function createMyRow() {
      var result = Ti.UI.createTableViewRow({
        className: 'myrow',
        height: 40,
        width: 'auto',
        backgroundGradient: {
          type: 'linear',
          colors: ['#f9f9f9','#d7d7d7'],
          startPoint: {x:0,y:0},
          endPoint:{x:0,y:37},
          backFillStart:false},
      });
    
      // top border
      result.add(Ti.UI.createView({
        top: 0,
        height: 1,
        backgroundColor: '#ccc',
      }));
    
      // bottom border
      result.add(Ti.UI.createView({
        bottom: 0,
        height: 1,
        backgroundColor: '#ccc',
      }));
    }
    
    — answered September 27th 2011 by Paul Mietz Egli
    permalink
    0 Comments
  • Add separatorColor: '#ccc' to your TableView. Titanium SDK 2.1.3.GA. Works for me on Android and should work for iPhone.

    — answered December 4th 2012 by Bryan Sloan
    permalink
    0 Comments
  • Very useful tip Bryan Sloan, thanks!

    — answered October 22nd 2013 by Hector Cedeno
    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.