Skip to content

inehemiasm/AiAssistant / skills/display-glasses-with-jetpack-compose-glimmer

display-glasses-with-jetpack-compose-glimmer

Verified

Provides guidelines for developing projected Android XR apps for display glasses using the Jetpack Compose Glimmer UI toolkit. This skill covers foundational Glimmer design principles, workflows for implementing Jetpack Compose Glimmer, and interaction models for the glasses form factor. Use this skill to build an Android XR Augmented Experience app with Jetpack Compose Glimmer that adheres to the Glimmer design system for optimized glasses styling.

FileKindSize
SKILL.mdskill md21.9 KB
references/android/design/ui/ai-glasses/guides/interaction/inputs.mdmarkdown2.3 KB
references/android/develop/xr/jetpack-xr-sdk/access-hardware-projected-context.mdmarkdown21.6 KB
references/android/develop/xr/jetpack-xr-sdk/jetpack-compose-glimmer/buttons.mdmarkdown4.7 KB
references/android/develop/xr/jetpack-xr-sdk/jetpack-compose-glimmer/cards.mdmarkdown6.5 KB
references/android/develop/xr/jetpack-xr-sdk/jetpack-compose-glimmer/focus.mdmarkdown5.6 KB
references/android/develop/xr/jetpack-xr-sdk/jetpack-compose-glimmer/icons.mdmarkdown4.6 KB
references/android/develop/xr/jetpack-xr-sdk/jetpack-compose-glimmer/text.mdmarkdown2.7 KB
references/android/develop/xr/jetpack-xr-sdk/jetpack-compose-glimmer/title-chips.mdmarkdown3.4 KB
references/android/develop/xr/jetpack-xr-sdk/request-hardware-permissions.mdmarkdown8.8 KB
references/button-samples-source.mdmarkdown4.5 KB
references/button-source.mdmarkdown8.8 KB
references/card-samples-source.mdmarkdown8.2 KB
references/card-source.mdmarkdown24.3 KB
references/deptheffect-source.mdmarkdown7.8 KB
references/deptheffectlevels-source.mdmarkdown4.1 KB
references/glimmersansflextypography-source.mdmarkdown11.3 KB
references/glimmertheme-source.mdmarkdown7.6 KB
references/icon-source.mdmarkdown16.9 KB
references/iconbutton-source.mdmarkdown5.2 KB
references/iconsizes-source.mdmarkdown2.3 KB
references/list-source.mdmarkdown18.0 KB
references/listitem-source.mdmarkdown11.6 KB
references/liststate-source.mdmarkdown17.4 KB
references/material-hct-source.mdmarkdown6.3 KB
references/projectedcontext-source.mdmarkdown10.7 KB
references/stack-source.mdmarkdown15.3 KB
references/stackitemscope-source.mdmarkdown16.2 KB
references/stackstate-source.mdmarkdown12.9 KB
references/surface-source.mdmarkdown29.0 KB
references/titlechip-samples-source.mdmarkdown2.9 KB
references/titlechip-source.mdmarkdown5.3 KB

references/android/develop/xr/jetpack-xr-sdk/jetpack-compose-glimmer/icons.md

View on GitHub
<br />


Applicable XR devices This guidance helps you build experiences for these types of XR devices. [Learn about XR device types →](https://developer.android.com/develop/xr/devices) ![](https://developer.android.com/static/images/develop/xr/ai-glasses-icon.svg) Display Glasses [](https://developer.android.com/develop/xr/devices#audio-display) [Learn about XR device types →](https://developer.android.com/develop/xr/devices)

<br />

In Jetpack Compose Glimmer, the [`Icon`](https://developer.android.com/reference/kotlin/androidx/xr/glimmer/Icon.composable) component is a UI element for
rendering single-color icons. Icons intelligently handle tinting and scaling so
that they remain legible and visually consistent with the [`GlimmerTheme`](https://developer.android.com/reference/kotlin/androidx/xr/glimmer/GlimmerTheme.composable).

## Sizes

While icons default to the size provided by [`LocalIconSize`](https://developer.android.com/reference/kotlin/androidx/xr/glimmer/package-summary#LocalIconSize()), you can also
use the three icon sizes provided to set an specific size. These sizes are also
used by default for the following contexts:

| Size token | Default usage |
|---|---|
| `small` | For standard list items or small chips. |
| `medium` | For standalone icons and title chips. |
| `large` | For high-emphasis components like cards. |

## Icon sources

Icons can accept [`ImageVector`](https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/vector/ImageVector), [`ImageBitmap`](https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/ImageBitmap), or [`Painter`](https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/painter/Painter) as
their source. When defining your own icons, use `ImageVector` where possible to
promote sharp rendering at any scale on display glasses.

## Color and Tinting

- **Automatic tint** : The icon resolves its color based on the `LocalContentColor` provided by the parent surface `LocalContentColor` provided by the parent surface, such as a [`surface`](https://developer.android.com/reference/kotlin/androidx/xr/glimmer/surface.composable) or [`Button`](https://developer.android.com/reference/kotlin/androidx/xr/glimmer/Button.composable).
- **Manual Tinting** : Use the `tint` parameter to apply a specific color.
- **Multicolored Assets** : For icons that should not be tinted (like multicolored brand logos), set `tint = Color.Unspecified`.
- **Generic Images** : For photographs or generic images that don't follow icon sizing and tinting rules, use the standard [`androidx.compose.foundation.Image`](https://developer.android.com/reference/kotlin/androidx/compose/foundation/Image.composable) instead.

## Example: Basic icon within a surface

The following code creates an icon placed inside a circular surface, utilizing
the theme's primary color:


```kotlin
@Composable
fun IconSampleUsage() {
    GlimmerLazyColumn(
        modifier = Modifier.fillMaxSize(),
        horizontalAlignment = Alignment.CenterHorizontally,
    ) {
        item { IconSizesSample() }
        item {
            Icon(
                FavoriteIcon,
                "Localized description",
                Modifier.surface(
                        shape = CircleShape,
                        color = GlimmerTheme.colors.primary,
                        border = null,
                    )
                    .padding(12.dp),
            )
        }
    }
}
```

<br />

## Example: Icons with different sizes

The following code demonstrates the different icon sizes:


```kotlin
@Composable
fun IconSizesSample() {
    val iconSizes = GlimmerTheme.iconSizes
    Column(
        verticalArrangement = Arrangement.spacedBy(20.dp),
        horizontalAlignment = Alignment.CenterHorizontally,
    ) {
        Icon(FavoriteIcon, "Localized description", Modifier.size(iconSizes.small))
        // medium is also the default size, defining explicitly for clarity
        Icon(FavoriteIcon, "Localized description", Modifier.size(iconSizes.medium))
        Icon(FavoriteIcon, "Localized description", Modifier.size(iconSizes.large))
    }
}
```

<br />

### Key points about the code

- Each icon's size is customized using [`GlimmerTheme.iconSizes`](https://developer.android.com/reference/kotlin/androidx/xr/glimmer/IconSizes) with a modifier. For icons, the default value is [`GlimmerTheme.iconSizes.medium`](https://developer.android.com/reference/kotlin/androidx/xr/glimmer/IconSizes#medium()). Use these sizes instead of hard-coding values to maintain consistency across your UI.
- Provides a localized `contentDescription` for each icon. Always provide these descriptions unless the icon is purely decorative.
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 322kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 198kUpdated Claude CodeCodexVerifiedInstall