Reputation: 558
I create my project libGDX and import it in Android studio. When I create a table and add Label, I could use .expandX() or .expand(). Look my follower code to understund.
Label Label1;
Label Label2;
Table table = new Table();
table.top();
table.setFillParent(true);
Label1 = new Label("I'am", new Label.LabelStyle(new BitmapFont(), Color.WHITE));
Label2 = new Label("Ian", new Label.LabelStyle(new BitmapFont(), Color.WHITE));
table.add(levelLabel).expandX();
table.add(countdownLabel).expand();
Which one should I use? and why? What are the differences?
Upvotes: 0
Views: 153
Reputation: 3815
expand()
is a combination of expandX()
and expandY()
. So if you want to allow expanding in height (if there is room for this) expand() would allow that.
Which you should use depends entirely on the result you want!
as a sidenote:
Use expand()
to make the logical cell expand within the table. if more than 1 cells have the expand tag, they will both expend using their sizes for ratio. If you want both to have the same size add 'uniform'
use fill()
to expand the actor inside the cell to fill the the logical cell.
Use grow()
to combine both of them in 1 command.
They all have the X and Y variants to only work in 1 direction.
Upvotes: 2