I want to swap the positions of two labels inside a table of libGDX. I thought I may use swapActors to do this, but it doesn't do the trick.
private Stage stage;
private Table table;
public MainScreen() {
stage = new Stage(new FitViewport(800, 480));
table = new Table(SkinManagerImpl.getDefaultSkin());
table.add("A").center();
table.add("B").center();
table.setFillParent(true);
boolean succes=table.swapActor(0, 1);
Gdx.app.log("", "success:"+succes);
table.layout();
stage.addActor(table);
}
@Override
public void render(float delta) {
// TODO Auto-generated method stub
super.render(delta);
stage.draw();
}
success is true, but it still says "AB" and not "BA" as wanted.
Is there another simple way to swap two cells or actors (meaning swap positions) inside a table?