框架

*此內容是使用 AI(Beta 測試版)翻譯,可能含有錯誤。若要以英文檢視此頁面,請按一下這裡

基本的 框架 作為其他 Gui物件 的容器,例如 標籤按鈕。您可以將框架應用於用戶的 螢幕 或遊戲中的 表面 上顯示。

螢幕上的範例框架,包含一個 TextLabel、TextBox 和 ImageButton。

框架是理想的容器,用於響應式佈局,例如 列表和彈性佈局,允許您改變框架的大小並動態調整佈局項目在其中的適應方式。框架 也是核心的 Gui物件,因此您可以自定義屬性,例如 背景顏色3透明度,應用 背景漸變邊框,等等。

除了作為容器的常見用途外,您還可以將 框架 用於 UI 設計。例如,作為其他 UI 元素之間的視覺分隔符,您可以將框架縮放為細長的形狀,直到它變成一條線。

剪裁

By default, GuiObject containers clip their content (descendant GuiObjects) through the ClipsDescendants boolean. If you want descendants to appear outside of a container's bounds, simply set ClipsDescendants to false.

Importantly, StarterGui.ClipsDescendantsSupportsRotation must be true for clipping to work on rotated descendants (non‑zero Rotation) within the container. However, clipping by a rotated container (clipping container itself is rotated) or by rounded corners (UICorner) is not supported. If you need clipping on rotated or rounded containers, consider CanvasGroup.

自動調整大小

框架可以根據其內容設置為 自動調整大小。要實現這一點,將框架的 大小 設置為 最小 寬度和/或高度,然後將其 自動大小 屬性設置為 XYXY,具體取決於自動調整大小應該應用於哪個軸。一旦設置,框架將根據其中的 Gui物件 和佈局的大小自動調整大小。

©2026 Roblox Corporation、Roblox、Roblox 標誌及 Powering Imagination 是我們在美國及其他國家地區的部分註冊與未註冊商標。