hz-metavrx-ui-set
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseUsing the Meta VR UI Set
使用 Meta VR UI Set
UISet is a Jetpack Compose component library and design system for Android apps
on Meta Horizon OS. Its dark and light themes ship Meta VR typography, shapes,
density, interaction states, and semantic colors complete and usable with no
configuration. Everything public lives under and its
subpackages.
metavrx.uiset.composeIt ships as the Maven artifact .
com.meta.metavrx.uiset:uiset-compose-compatThis skill uses progressive disclosure: this page is the map — load the one
reference file that matches your task.
UISet 是面向 Meta Horizon OS 上 Android 应用的 Jetpack Compose 组件库和设计系统。其深色和浅色主题内置 Meta VR 字体排版、形状、密度、交互状态和语义颜色,完整可用,无需任何配置。所有公开 API 均位于 及其子包下。
metavrx.uiset.compose它以 Maven artifact 的形式发布。
com.meta.metavrx.uiset:uiset-compose-compat此 skill 使用 渐进式披露:本页是一张地图——请加载与你的任务匹配的一个参考文件。
Mental model
心智模型
kotlin
@Composable
fun AppContent(onContinue: () -> Unit) {
UiSetTheme { // dark scheme, VR typography, Standard density
Surface {
Column {
Text("Guardian", style = UiSetTheme.typography.headline)
LabelButton(label = "Continue", onClick = onContinue)
}
}
}
}Below the theme it is ordinary Compose — // from foundation,
your own state, normal recomposition. The deltas from a Material 3 app are small
but they are replacements, not additions:
RowColumnBox| Material 3 | UISet |
|---|---|
| |
| |
| |
| |
| |
| |
UISet does not extend Material. The names collide, the types do not — import
from and do not mix the two in one screen.
metavrx.uiset.compose.*kotlin
@Composable
fun AppContent(onContinue: () -> Unit) {
UiSetTheme { // dark scheme, VR typography, Standard density
Surface {
Column {
Text("Guardian", style = UiSetTheme.typography.headline)
LabelButton(label = "Continue", onClick = onContinue)
}
}
}
}在主题之下,它就是普通的 Compose——使用 foundation 提供的 //、你自己的状态以及常规重组。它与 Material 3 应用之间的差异很小,但这些差异是替换项,而不是新增项:
RowColumnBox| Material 3 | UISet |
|---|---|
| |
| |
| |
| |
| |
| |
UISet 并未扩展 Material。名称会冲突,但类型并不相同——请从 导入,并且不要在同一个屏幕中混用两者。
metavrx.uiset.compose.*Rules that bite
容易踩坑的规则
- Import from UISet, not Material. ,
Text,Icon,Surface,Checkbox,RadioButton,Switch,Slider,Iconsall exist in both. Mixed imports compile and then render unthemed.LocalContentColor - Icons are properties.
@Composableresolves a vector resource, so reading it is a composable call — it cannot be evaluated in aIcons.Regular.Add, an enum argument, or avalblock. Componentremember { }/iconparameters takeleadingIconfor exactly that reason.@Composable () -> Unit - Item lists must be .
PersistentList,Dropdown, andIconDropdowntakeChoiceListDialogfrom kotlinx-collections-immutable; build withPersistentList<…>insidepersistentListOf(…).remember - Dialogs are modal and caller-controlled. Emit them under
and always pass
if (showDialog) { … }.onDismissRequest - Every interactive target is at least 48dp in both dimensions, whatever the
density preset or a custom says. Visible artwork can be smaller than its target; lay out with the target in mind.
Dimensions.minimumInteractiveSize - Icon-only controls require a — it is a required parameter on
contentDescription, not an optional one.IconButton - Components read the theme through composition locals. Anything outside a
gets the built-in defaults and your customization never reaches it.
UiSetTheme
- 请从 UISet 而非 Material 导入。 、
Text、Icon、Surface、Checkbox、RadioButton、Switch、Slider和Icons在两者中都存在。混合导入虽然能够编译,但渲染时不会应用主题。LocalContentColor - 图标是 属性。
@Composable会解析为矢量资源,因此读取它本身就是一次 composable 调用——不能在Icons.Regular.Add、枚举参数或val块中求值。组件的remember { }/icon参数正是出于这一原因采用leadingIcon。@Composable () -> Unit - 条目列表必须是 。
PersistentList、Dropdown和IconDropdown接收来自 kotlinx-collections-immutable 的ChoiceListDialog;应在PersistentList<…>中使用remember构建。persistentListOf(…) - 对话框是模态且由调用方控制的。 将它们放在 下渲染,并且始终传入
if (showDialog) { … }。onDismissRequest - 无论密度预设或自定义 的值如何,每个交互目标的两个维度都至少为 48dp。 可见图形可以小于其目标区域;布局时应以目标尺寸为准。
Dimensions.minimumInteractiveSize - 仅含图标的控件必须提供 。 它是
contentDescription的必填参数,而不是可选参数。IconButton - 组件通过 composition locals 读取主题。 位于 之外的任何内容都会使用内置默认值,你的自定义设置也无法生效。
UiSetTheme
Read what you need
按需阅读
- references/components.md — which component to
reach for, what the emphasis levels mean, and the behaviour that is not visible in a signature. Start here for "which component, and what will it do that I don't expect".
ButtonStyle - references/theming.md — , the semantic
UiSetThemeroles, typography, shapes, density, and interaction indications, plus the customization ladder from a one-value copy to a full replacement. Read when colors or metrics need to change.ColorScheme - references/icons.md — , the composable-getter constraint, the icon-slot pattern, and how to find an icon.
Icons.Regular - references/integration.md — adding UISet to an Android app with Gradle and the Horizon OS manifest shape. Read when wiring the dependency, not the API.
- references/migration.md — moving off the
Spatial SDK UI Set (): the coordinate and package changes, the
com.meta.spatial:meta-spatial-sdk-uisetrename table, and the behavioral differences. Read when the existing code saysSpatial*.SpatialTheme
For exact signatures and KDoc, hover the symbol in your IDE — every public type
is documented. Outside the IDE, reaches
the same reference.
metavr docs api-search "<Component>"- references/components.md——该使用哪个组件、的强调级别意味着什么,以及签名中看不出来的行为。如果你想知道“应该选择哪个组件,以及它会有哪些预期之外的行为”,请从这里开始。
ButtonStyle - references/theming.md——、语义
UiSetTheme角色、字体排版、形状、密度和交互指示,以及从复制单个值到完全替换的定制路径。需要更改颜色或度量值时阅读。ColorScheme - references/icons.md——、composable getter 约束、图标插槽模式,以及如何查找图标。
Icons.Regular - references/integration.md——使用 Gradle 将 UISet 添加到 Android 应用,以及 Horizon OS manifest 结构。在接入依赖项时阅读,无需关注 API。
- references/migration.md——从 Spatial SDK UI Set()迁出:坐标和包变更、
com.meta.spatial:meta-spatial-sdk-uiset重命名对照表以及行为差异。当现有代码中出现Spatial*时阅读。SpatialTheme
如需查看精确签名和 KDoc,可在 IDE 中将鼠标悬停在符号上——每个公开类型都有文档。在 IDE 之外,命令 可访问同一份参考资料。
metavr docs api-search "<Component>"