For some reason I can't find an answer for this.
I want to place my actor outside the Screen (or Stage) and then add an Action to move it into the Screen.
I've tried:
Table table = new Table();
table.setX(-100) //place outside of screen
Label label = new Label("test", skin);
table.add(label);
table.addAction(Actions.moveBy(200f, 0f, 1f)); //move into Screen
//...
anotherTable.add(table); //I've tried setting X here aswell but to no effect
Whatever I do the table just starts in the middle of the Screen and then starts moving, even if I add a position that's inside the Screen like (100, 100), it still just places itself in the middle. What am I missing?
答案 0 :(得分:1)
我猜你在代码中某处调用了table.setFillParent(true);
,因为这会使表格有一个固定的位置,并且会禁用更改它的能力(如果你认为这是有道理的) setFillParent
的观点)。
显然,您可以通过删除table.setFillParent(true);
来解决此问题。如果您需要该功能,则可以在将表格移动到其位置后调用该行。