gpt4 book ai didi

java - libGDX - 如何将表格填充到单元格大小?

转载 作者:行者123 更新时间:2023-12-02 11:37:55 25 4
gpt4 key购买 nike

我想在Cell中创建子Table以填充该单元格作为父单元。

    // Main Table
Table mainTable = new Table();

// Sub Table
Table subTable = new Table();

mainTable.add( ).expand().row(); // cell-1

mainTable.add(subTable).expand().row(); // cell-2

mainTable.add( ).expand().row(); // cell-3

代码结果:

enter image description here

我创建subTable.setFillParent(true)时,它将填充到mainTable。好的,很好。

enter image description here

但是我想让subTable填充以扩大cell-2的大小。

我的意思是:

enter image description here

我怎样才能做到这一点?

最佳答案

查看 LibGDX 维基:https://github.com/libgdx/libgdx/wiki/Table#fill

The fill method causes a widget to be sized to the cell. Like expand, there are also fillX and fillY methods.

table.add(nameLabel).expand().bottom().fillX();

...

关于java - libGDX - 如何将表格填充到单元格大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48789600/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com