Titanium Community Questions & Answer Archive

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

Spacing between TableViewSections in Grouped TableView

Is there a way to decrease the spacing between each tableViewSection? In other words, can the padding on the top and bottom of each section be changed? Thanks in advance!

— asked October 26th 2010 by Jonathan Nutter
  • iphone
  • tableviewsection
0 Comments

1 Answer

  • You need to create a view with the desired height and add it to the table view section like so :-

     var tableSection = Ti.UI.createTableViewSection();
     tableSection.headerView = Ti.UI.createView({height:8});
    

    For table view at the top you also need to take into account the header for the table itself and do the same as above :-

    var table = Titanium.UI.createTableView({
        data:data,
        style:Titanium.UI.iPhone.TableViewStyle.GROUPED,
        backgroundColor:TABLE_BACKGROUND_COLOR
    });
    
    table.headerView = Ti.UI.createView({height:1}) // height cannot be 0
    
    — answered January 9th 2011 by Shamsul Azhar Ahmad Shamsuddin
    permalink
    1 Comment
    • Don't forget to also configure the footerView also. THe headerView is only half of the gap between sections!

      — commented March 21st 2012 by Darren Cope
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.