如何将 Scene2d Actor 放在彼此之上?,我正在尝试制作一个照片库。我将向表格添加一个图像 Actor ,然后在侧面有用于切换图像的按钮。但是将 Actor 添加到表中是一场噩梦,您无法指定位置,而且最重要的是您无法将一个 Actor 添加到另一个 Actor 之上。 Scene2d 中有解决方案吗?
最佳答案
正如评论中提到的,尝试使用 Stack来自 Libgdx 的类。
简单示例 -
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.
关于java - 如何将 Actor 放在彼此之上?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49208493/