我想交换libGDX表中两个标签的位置.我以为我可以使用swapActors来做到这一点,但它没有做到这一点.
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();
}
Run Code Online (Sandbox Code Playgroud)
成功是真的,但它仍然说"AB"而不是"BA".
是否有另一种简单的方法可以在表格内交换两个单元格或演员(意味着交换位置)?