Search code examples
javalibgdxcell

Libgdx changing cellsizes without having the table rescaling everything


I am using a table with buttons, scrollpanes and textfields. But the problem is, when I change the size of a cell in the table..The entire table rescales. How do I change the size of a cell in a table without everything else with it?

I hope I expressed myself correctly in this.


Solution

  • You should read this: TableLayout documentation. It seems like expand() is more or less what you are looking for. It gives the selected cell the rest of the available space. also setting width(desiredWidth) and height(desiredHeight) should do what you like to do. You have to call this functions for the Cell you want to change. So store your cell like: Cell cell = table.add(button); and then use cell.width(myWidth) or directly use table.add(button).width(myWidth);. I think this should work. Note that this code is only pseudocode and you should not use this, but this concept.