如何将演员放在彼此之上?

How to put Actors on top of each other?

如何将 Scene2d 演员放在彼此之上?,我正在尝试制作照片库。我将向 Table 添加一个图像演员,然后在两侧有用于切换图像的按钮。但是将演员添加到 table 是一场噩梦,您无法指定位置,最重要的是您无法在另一个演员之上添加一个演员。在 Scene2d 中有解决方案吗?

如评论中所述,尝试使用 Libgdx 中的 Stack class。

简单示例 -

    Table root = new Table();
    Stack stack = new Stack();

    Table imageTable = new Table();
    //do stuff with table.

    Table buttonTable = new Table();
    //do stuff with button table

    stack.add(imageTable);
    stack.add(buttonTable); //button table will be placed exactly above imageTable

    root.add(stack);
    //do whatever you wanna do now with the root like adding on stage.