npx skills add ...
npx skills add android/skills --skill display-glasses-with-jetpack-compose-glimmer
Provides guidelines for developing projected Android XR apps for display
npx skills add android/skills --skill display-glasses-with-jetpack-compose-glimmer
| Term | Definition |
|---|---|
| Intelligent Eyewear | All-day wear, hands-free devices that provide access to information. Equipped with speakers, a camera, and a microphone. Some are audio-only (audio glasses), and some also have a display (display glasses). |
| Display glasses | Audio glasses with the addition of a private display in lenses for glanceable visuals that harmonize with audio output. |
| Jetpack Compose Glimmer | A Compose UI toolkit for building augmented Android XR experiences, optimized for display glasses. It provides components, theming, and behaviors for transparent displays. |
| Projected Activity (Glasses Activity) | An Android Activity that runs on a host device (phone) but its UI and interactions are projected to a connected, intelligent eyewear device (audio or display glasses). |
| Projected Device | An XR device connected to an Android-powered device (host). Host projects the application content to the Projected device and let users interact with it. |
| GlimmerTheme | The root provider for styling tokens, including GlimmerColors, GlimmerTypography, and GlimmerShapes. |
| Additive Display | A display technology where black (#000000) is rendered as 100% transparent. UI is built by adding light to the environment. Display glasses have an additive display. |
| Augmented Experiences | Android XR experiences that enhance a user's focus and presence in the real world. They are lightweight and additive, helping users while they are on-the-go |
| Visual Angle | A unit of measurement for perceived size in XR. The minimum readable text size is 0.6 degrees (approx. 18sp at 1 m). |
compileSdk 37 or higher. If the compileSdk is lower than 37, increase the compileSdk to 37.MaterialTheme or Material Components.GlimmerTheme and Jetpack Compose Glimmer Components.createGoogleSansFlexTypography() from androidx.xr.glimmer:glimmer-google-fonts as the Typography value for GlimmerTheme to ensure that consistent typography is applied throughout the components.ShadowScope or Depth tokens from Jetpack Compose Glimmer.android.hardware.display.category.XR_PROJECTED for the android:requiredDisplayCategory attribute in app manifest to tell the system that this is a projected activity.ProjectedContext to launch the Glasses Activity on the glasses. Place the 'Launch on Glasses' button as a screen-level FloatingActionButton, in the TopAppBar, or in the top navigation bar to ensure users discover the projection capability. If the glasses aren't connected, disable the button. Don't launch the Glasses Activity on the phone, only on the display glasses. If it makes sense to automatically launch the Glasses Activity without an explicit launch button, then do so.androidx.xr.glimmer:glimmer library, if not it must be added to the project. See Declaring Jetpack Compose Glimmer Dependencies to fetch the latest dependency version.GlimmerTheme composable to ensure correct token resolution.Modifier.background(Color.Black)) on the root container of your Projected Activity.androidx.xr.glimmer.googlefonts library with the default type styles unless otherwise specified. Use createGoogleSansFlexTypography to create a Typography instance with the Google Sans Flex configuration. Provide this Typography instance as normal through GlimmerTheme. Use references/glimmersansflextypography-source.md for configuration.Stack) to minimize obstruction of the user's field of view. Avoid multiple simultaneous cards.Jetpack Compose Glimmer is the UI toolkit for building augmented experiences on display glasses.
Card, ListItem, Button, etc.isInitialFocusOnFocusableAvailable flag to true in your activity's onCreate method. For more information on how to implement, see Focus in
Jetpack Compose Glimmer.Glimmer styles are accessed through the GlimmerTheme object. Use
references/glimmertheme-source.md for reference.
| Category | Token | Value / Role |
|---|---|---|
| Color | primary | #9BBFFF (Focal color) |
| Color | secondary | #4C88E9 (Focal color) |
| Color | surface | #262626 (Transparent base - renders as transparent) |
| Color | outline | #606460 (3.dp border color) |
| Shape | Standard | RoundedCornerShape(36.dp) |
| Shape | Small | RoundedCornerShape(12.dp) |
Strict default: When creating Glimmer UI you must use Google Sans Flex unless a custom brand typeface is explicitly specified. Variable Font Settings: As Google Sans Flex is a variable font, you must configure the following axes:
ROND): Always set to 100f for the signature rounded appearance.wdth): Set to 100f.opsz): Set to 9f.wght): Use specific values for different roles (Title: 725f, Body: 520f, Caption: 650f).| Style Name | Size / Line-Height | Weight Axis | Width | Roundness | Optical size |
|---|---|---|---|---|---|
| Title Large | 30.sp / 36.sp | 725 | 100 | 100 | 9 |
| Title Medium | 24.sp / 32.sp | 725 | 100 | 100 | 9 |
| Title Small | 20.sp / 28.sp | 725 | 100 | 100 | 9 |
| Body Large | 30.sp / 36.sp | 520 | 100 | 100 | 9 |
| Body Medium | 24.sp / 32.sp | 520 | 100 | 100 | 9 |
| Body Small | 20.sp / 28.sp | 520 | 100 | 100 | 9 |
| Caption | 18.sp / 28.sp | 650 | 100 | 100 | 9 |
Simulate depth on display glasses using shadows to establish a sense of
hierarchy through varying levels of emphasis. The Jetpack Compose Glimmer
controls use DepthEffect with 5 preset DepthEffectLevels. Use
references/deptheffect-source.md and
references/deptheffectlevels-source.md for reference.
Some examples:
| Level | Usage |
|---|---|
| level1 | Standard rest state for cards and persistent background UI. |
| level2 | Standard focus/pressed state for buttons and interactive cards. |
| ExtraSmall | 4.dp |
Cards are a fundamental surface-based container in Glimmer used to group related content, such as text, images, icons and actions into a single focal point. They establish a clear depth plane (Z-axis) in the Glasses environment, providing a stable background for text, images, and icons. Never embed a card within a List Item.
onClick lambda is provided.onClick lambda to enable focus effects.onClick as null if the Card contains multiple internal interactive elements (like separate buttons or switches) to avoid focus contention.If you are creating a Glimmer Card component, read the:
Buttons are the primary triggers for discrete actions in Glimmer. They are specifically optimized for the display glasses focus model, where a focus highlight is added when focus is moved to the button using the touchpad or other methods.
If you are creating a Glimmer Button component, read the:
Chips are a pill-shaped, specialized labeling component designed to sit above a
Card or a group of content to provide a title. Use title chips to display
concise information like a short title, a name, or a status.
TitleChip preceding content, you must use TitleChipDefaults.AssociatedContentSpacing (8.dp) to maintain the visual hierarchy.If you are creating a Glimmer Title Chip component, read the:
Icons are visual symbols used to represent concepts, actions, or status in a concise way. In Glimmer, icons and icon buttons are optimized for the XR environment, providing clear visibility on additive displays and gaze-responsive feedback for interactive elements.
IconSizes (e.g., Standard, Large) to ensure icons remain legible and meet the minimum touch target requirements for the XR environment.IconButton to provide the automatic visual feedback and required tap-target padding.Icon for non-interactive indicators or status symbols.If you are creating a Glimmer Icon component, read the:
Lists are containers that allow you to navigate between and see multiple items on glasses. If your use case works with only seeing one item in the list at a time, use a Glimmer Stack. Use lists with a Title Chip when the list items are similar in type. Also use a Glimmer Stack if the items are of different types.
ListItem composable for rows. It provides predefined slots. Use references/listitem-source.md for reference.GlimmerTheme.colors.surface) and corner radius (standard 36.dp) for every item. Don't vary these unless you are visually grouping different types of content.TitleChip to maintain spatial consistency.verticalArrangement = Arrangement.spacedBy(20.dp) for GlimmerLazyColumn to ensure visual separation between items on the glasses display.If you are creating a Glimmer List component, read the:
A stack is a collapsed list that only displays one piece of content at a time, in a stacked visual, such as a card. If it is useful to show more than one item at a time, use the Glimmer List control. Don't use a title chip with a stack. If the items are of different types use a stack to show them. If the items are of the same type, use a list.
Layout tips
.itemDecoration(CardDefaults.shape) modifier to the Card (or relevant container) inside every item block.ShadowScope, DepthEffect, or prescribed DepthEffectLevels for depth plane scaling.If you are creating a Glimmer Stack component, read the:
In Jetpack Compose Glimmer, the Text component builds off the Compose
text component, and lets you set various text properties. Be sure to choose a
style from the GlimmerTheme for your text. Modify the theme for your
application if you want custom typography.
On transparent Display Glasses (additive displays), standard Material Text
resolves to dark foreground tokens which render as transparent and invisible.
Glimmer Text intelligently manages theme color matching. When no manual color
override is specified, Glimmer Text automatically defaults to the content
color provided by the nearest Glimmer surface.
Surface is a fundamental building block in Glimmer. Use
references/surface-source.md for reference.
A surface represents a distinct visual area or 'physical' boundary for components such as buttons and cards. Use it if you need to build a custom component.