title: JavaFX ListView - remove spacing / padding / margin between cells
body: <p>As I have <strong>custom cells</strong> for a particular <code>ListView</code>, I have big trouble to understand how to to remove the "natural" sort of margin / spacing there is between each cells, and, even worse, on the right and left sides of said cells.</p>
  
  <p>Here's an example: </p>
  
  <p><img src="https://i.stack.imgur.com/NoWBk.png" alt="image to showcase spacing between cells">]<a href="https://i.stack.imgur.com/NoWBk.png" rel="nofollow noreferrer">1</a></p>
  
  <p>As you can see, I use a color to bring out each cell. You cannot see the space at the end of the cells (on their right side), because I need to scroll, but you can trust me, the white space is equal on each side (bigger on the left &amp; right, though...) which is not normal as I have specifically designed these cells so that their width is as large as the <code>ListView</code> so that there is no need to use horizontal scrolling. My issue kinds of defeat my purpouse...</p>
  
  <p>Each cell consists of one <strong>AnchorPane</strong> with the image and the one label.
  The <code>AnchorPane</code> is painted in yellow (<code>-fx-background-color: yellow;</code>).</p>
  
  <p>And as you can clearly see, there is these white spaces all around the cells.</p>
  
  <p>FYI, here I am using <strong>JavaFX 8 / 2.2 SDK</strong> but I intend to use <a href="https://github.com/jfoenixadmin/JFoenix" rel="nofollow noreferrer">JFoenix</a> <code>JFXListView</code> &amp; <code>JFXListCell</code>. However, the spacing is even worse using those.</p>
  
  <p>Strange point: I also painted the <code>ListView</code>in green, but such color is nowhere. to be seen. I guess all the cells (and the empty one) overwrites the <code>ListView</code> content, so it would make sense not to see its background. However, this means the cells are somehow "corrupted" since white spaces are "added" all around my cells.</p>
  
  <p>I have tried to set padding to 0 for everything but in vain.</p>
  
  <p>Finally, in the <code>onUpdateItem</code> method, I do call the <strong>super method</strong> and when the cell is not flagged as <strong>empty</strong>, I set the graphic to the aforementioned AnchorPane otherwise I set it to null, which is clearly consistent to my screenshot.</p>
  
  <p>Thanks for the help !</p>