# What is the difference between expand(), grow() and fill() in libGDX?

I am currently working with scene2d tables. But I am tired of using hit and trial to make the layout I wanted. Can anyone explain the meanings of expand, fill and grow? I need the behaviour like wrap_content and match_parent as in android.

Some code I tried is:

    Table contentTable = scoreDialog.getContentTable();
contentTable.debugAll();

Table topTable = new Table();
topTable.debugAll();
topTable.top();

topTable.add(timeImage).colspan(2).pad(5);
topTable.add(timeProgressBar).colspan(5).pad(5);
topTable.add(bonusLabel).colspan(3).pad(5);
topTable.row();
topTable.add(alignImage).colspan(2).pad(5);
topTable.add(alignProgressBar).colspan(5).pad(5);
topTable.add(penaltyLabel).colspan(3).pad(5);

contentTable.row();
contentTable.add(topTable).colspan(10).pad(5).expandX().align(Align.center);
contentTable.row();

contentTable.add(scoreLabelDialog).colspan(10).pad(5).expandX().align(Align.center);
contentTable.row();

starsTable = new Table();
starsTable.setHeight(50);
contentTable.add(starsTable).pad(5).colspan(10).expandX().align(Align.center);


## 1 Answer

Expand: expands the cell that the actor is currently placed in to occupy the largest possible area without changing other cells size. For example if the cell is 50 x 50 and there is 50px of empty space to the sides of the cell it will resize to 100 x 50. Only changes the size of the cell, not the actor.

Fill: makes the actor occupy the entire space of the cell. For example if the actor is 50 x 50 and the cell is 100 x 100 the actor will be resized to 100 x 100. Only changes the size of the actor not the cell.

Grow: both expand and fill at the same time.