I'm new to libgdx and I'm currently working on TableLayout and wondering how could I draw borders for each cells.

I've done some research on this but it seems that I could come up with this solution only: https://stackoverflow.com/questions/13828423/drawing-table-borders-in-libgdx-0-9-7

However, turning on the debug option would be a bit dumb and it's not what I want. I'd like to control the color, thickness of the cell border. Is there anyway to achieve this?


  • \$\begingroup\$ There's also someone suggesting to use a ninepatch as background for the table. You could try to get the tables size and but a ninepatch behind/in front of it with a transparent middlepart and visible outer part \$\endgroup\$ – VaTTeRGeR Apr 11 '15 at 10:37

I don't believe there is a built-in function for this.

You have a few options though:

  1. Use a 9-patch for table background with a border (thats what I do)

  2. Place another table underneath the main table, and make the size a bit bigger so you can see the edges, giving the impression of a border. This is probably your best choice since you want to control color/thickness etc.

  • 1
    \$\begingroup\$ Still no better solutions ? \$\endgroup\$ – Winter Jan 4 '17 at 20:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.