Reputation: 1858
I have a table that contain labels and buttons and I want to add a background to the logical table only, that contains the elements.
table = new Table();
table.setFillParent(true);
table.setBackground(skin.getDrawable("bg"));
The problem is that the background is set to the entire screen.
Upvotes: 0
Views: 239
Reputation: 1034
Because you've used setFillParent(true), the table is obviously sized to the parent. If this is the only table you have on your stage (called the root table), then the table will be the size of the stage, which is most likely the size of your screen. Thus the background will fill the entire screen.
You'd need to create some nested tables for your labels and buttons, where those tables are NOT sized to the entire screen, then set the background on those smaller tables. The wiki entry for Tables is quite informative, if you haven't come across it: https://github.com/libgdx/libgdx/wiki/Table
Upvotes: 1