我有這樣的代碼建立了一塊UI的:表格佈局不表現爲預期
// Trying to fix the layout by setting the defaults for the next row.
layout.row().expand(false, false).fill(false).colspan(4);
Label playerLabel = new Label(Settings.playerName + " " + playerScore, skin, "defaultWhite");
layout.add(playerLabel).colspan(1);
Label historyLabel = new Label(getHistory(), skin, "defaultWhite");
historyLabel.setAlignment(2);
layout.add(historyLabel).colspan(2).expandX();
Label cpuLabel = new Label(cpuScore + " CPU", skin, "defaultWhite");
layout.add(cpuLabel).colspan(1);
layout.row();
我預計它使玩家和CPU分數被推到側面和歷史標籤來獲取剩餘空間,但是這是它在做什麼:
難道我做錯了什麼嗎?我看不出有什麼可能是錯誤的。
如果您想查看其餘的代碼,請查看github,或者只是詢問,我會提供更多的上下文。
這就是我要與此同時,我還通過在分數標籤上使用uniform()方法,讓它像我想要的那樣工作,但使用更多的表格可以讓我更好地控制佈局。 – TheOsirian