Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

GridContainer

繼承: Container < Control < CanvasItem < Node < Object

將子控制項按照網格佈局排列的容器。

說明

GridContainer 會將其子控制項按照網格佈局排列。網格的列數由 columns 屬性指定,行數取決於容器中子控制項的數量。將保留每個大小的容器的列和行。

注意:GridContainer 只對繼承自 Control 的子節點生效。它不會重新排列繼承自 Node2D 的子節點。

教學

屬性

int

columns

1

主題屬性

int

h_separation

4

int

v_separation

4


屬性說明

int columns = 1 🔗

  • void set_columns(value: int)

  • int get_columns()

GridContainer 中的列數。修改後,GridContainer 會重新排列其衍生自 Control 的子節點,以適應新的佈局。


主題屬性說明

int h_separation = 4 🔗

The horizontal separation of child nodes.


int v_separation = 4 🔗

The vertical separation of child nodes.