Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Table.getHeight() always returns 0 though it shouldn't

Tags:

libgdx

scene2d

I'm trying to arrange and scale some elements inside a table and I need to know the Table's height in order to achieve all that. The problem is that whenever I try to get its height it always returns 0 even though the table is obviously on the screen and has a definite size. Why is that?

table_height = table.getHeight();
like image 400
gogonapel Avatar asked Dec 13 '14 13:12

gogonapel


1 Answers

I suggest you to use the method pack() on the table before calling getHeight(). This will set your table its height and width.

table.pack();
table_height = table.getHeight();
like image 89
Gregzenegair Avatar answered Sep 28 '22 01:09

Gregzenegair