框架

*此内容使用人工智能(Beta)翻译,可能包含错误。若要查看英文页面,请点按 此处

基本的 框架 作为其他 GuiObject 的容器,例如 标签按钮。您可以将框架应用于用户的 屏幕 或游戏中的 表面 上进行显示。

屏幕上的示例框架,包含一个 TextLabel、TextBox 和 ImageButton。

框架是响应式布局的理想容器,例如 列表和弹性布局,允许您更改框架的大小并动态调整布局项在其中的适应方式。框架 也是核心的 GuiObject,因此您可以自定义属性,例如 背景颜色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,具体取决于自动调整大小应应用于哪个轴。一旦设置,框架将根据其中的 GuiObject 和布局的大小自动调整大小。

©2026 Roblox Corporation、Roblox、Roblox 标志及 Powering Imagination 是我们在美国及其他国家或地区的注册与未注册商标。