对于libgdx项目,我希望在顶部居中并排的3张图像相互接触,但由于某种原因,中间的图像没有居中,他们不会到达顶部。它们连接到按钮“后退”演员。
我试过了:
Table table = new Table();
table.setFillParent(true);
table.setBackground(new TextureRegionDrawable(new TextureRegion(new Texture("background.png"))));
table.padTop(50);
table.add(characters).top().left();
table.add(items).top();
table.add(upgrades).top().right();
table.row();
table.bottom();
table.add(back).size(back.getWidth(), back.getHeight()).colspan(2).padBottom(70);
table.row();
stage.addActor(table);
答案 0 :(得分:1)
如果您想以某种方式说明您想要实现什么以及您的结果是什么,那么回答您的问题会更容易。 (这永远不会太晚)
反正: 你有3个图像,你希望它们在顶部相互接触。
table.top();
table.add(characters).expandX().padTop(50);
table.add(items).expandX().padTop(50);
table.add(upgrades).expandX().padTop(50);//three images fill up total space given
应该为您提供所需的布局。
启用table.setDebug(true);
将通过在表格,单元格和窗口小部件周围绘制调试行来帮助您进行调试。
如果您正在寻找有关主题的更多内容,则可以使用Table
的优秀wiki:
https://github.com/libgdx/libgdx/wiki/Table