从scene2d.ui 表中删除单元格

mat*_*boy 4 libgdx

我试图从表格中删除一行,并将该行下方的所有内容向上移动一行。我根本没有成功。我已经尝试遍历所有单元格(使用Table.getCells())并以各种方式更新它们,但它似乎并不像我想要的那样工作。有没有办法做到这一点?

XII*_*-th 5

您可以Actor像这样删除它的单元格:

public static void removeActor(Table container, Actor actor) {
    Cell cell = container.getCell(actor);
    actor.remove();
    // remove cell from table
    container.getCells().removeValue(cell, true);
    container.invalidate();
}
Run Code Online (Sandbox Code Playgroud)

这不是很漂亮的解决方案,但它有效