LibGDX: Scene 2D Table, 是否可以像图像和标签那样重叠两个演员?
LibGDX: Scene 2D Table, Is it possible to overlap two actors like an image and a label?
下图解释了我想要做什么。
上图代表我现在的安排。
下图表示我想要的排列方式。这是一个图表:
我希望标签 actor 位于图像 actor 之上。
这可以做到吗?
感谢@noone 指导我了解堆栈。请注意我的代码是滚动窗格的一部分。另请注意,要添加到堆栈的最后一项将位于顶部。所以这就是我添加图像然后添加标签的原因。
Image image = new Image(texture);
Label buildingName = new Label(entry.getValue.name, skin, "building");
buildingName.setAlignment(Align.top);
Stack stack = new Stack();
stack.add(image);
stack.add(buildingName);
stack.addListener(buildItemUIListener); //used for click listener
stack.setName(entry.getKey()); //Used for the click listener
table.add(stack);
下图解释了我想要做什么。
上图代表我现在的安排。
下图表示我想要的排列方式。这是一个图表:
我希望标签 actor 位于图像 actor 之上。
这可以做到吗?
感谢@noone 指导我了解堆栈。请注意我的代码是滚动窗格的一部分。另请注意,要添加到堆栈的最后一项将位于顶部。所以这就是我添加图像然后添加标签的原因。
Image image = new Image(texture);
Label buildingName = new Label(entry.getValue.name, skin, "building");
buildingName.setAlignment(Align.top);
Stack stack = new Stack();
stack.add(image);
stack.add(buildingName);
stack.addListener(buildItemUIListener); //used for click listener
stack.setName(entry.getKey()); //Used for the click listener
table.add(stack);