Is it somehow possible to set Scene2D table cell´s size in percentage of the table?

I would like to have orientation independent menu, with buttons filling let´s say 75% percent of the screen, and also to respond on window resizing (desktop version). I have tried several methods, for example using Value


but when value.get(actor) is called inside cell, it is supplied with inner button actor not its container (table).

I have also tried to set it in fixed fashion


This works fine, but since I set pixel value insted of Value object it is not recalculated upon resizing.

Is there any way to achieve this?


1 Answer 1


You can change the Actor that the Value acts on by supplying the actor (in your case your table) in the constructor like so:

table.add(button).width(Value.percentWidth(.75F, table));

This will make Value use that actor for the Value#get(actor) method instead of the default parent actor.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .