Chuyển đến nội dung
Skillpedia
Website và giao diện (frontend)10k · #11941

display-glasses-with-jetpack-compose-glimmer

Skill này làm gì

Skill này cung cấp hướng dẫn xây dựng ứng dụng Android XR hiển thị nội dung trên kính hiển thị, dùng bộ công cụ Jetpack Compose Glimmer. Nó bao quát nguyên tắc thiết kế, quy trình và tương tác cho kính. Nó dành cho lập trình viên Android xây trải nghiệm có thể xem lướt nhanh trên kính thông minh.

Khi nào nên dùng

  • ✓Khi bạn muốn xây ứng dụng Android XR hiển thị nội dung dễ xem lướt nhanh trên kính hiển thị.
  • ✓Khi bạn cần chủ đề và thành phần Glimmer cho màn hình kính.
  • ✓Khi bạn muốn lên kế hoạch kích thước chữ và bố cục cho trải nghiệm trên kính hiển thị.

Liên kết skill

https://github.com/android/skills/blob/main/xr/display-glasses-with-jetpack-compose-glimmer/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/android/skills/blob/main/xr/display-glasses-with-jetpack-compose-glimmer/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Xây một ứng dụng Android XR đơn giản hiển thị cuộc họp tiếp theo của tôi trên kính hiển thị bằng Compose Glimmer.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Skill thiết lập activity được chiếu và kiểm tra SDK mục tiêu, rồi áp dụng chủ đề và thành phần Glimmer. Nó làm theo các nguyên tắc thiết kế kính để chữ dễ đọc và tương tác theo tiêu điểm.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Glossary

Term Definition
Intelligent eyewear Hands-free eyewear with speakers, camera, and microphone (audio-only or display glasses).
Display glasses Eyewear with a private in-lens display for glanceable visuals that pair with audio.
Jetpack Compose Glimmer Compose UI toolkit providing components, theming, and focus behavior for display glasses.
Projected activity An Activity running on a phone host whose UI and input are projected to connected eyewear.
Projected device An XR eyewear device connected to an Android host phone that projects app content to it.
GlimmerTheme Root styling provider for GlimmerColors, GlimmerTypography, and GlimmerShapes.
Additive display Display where black (#000000) renders as 100% transparent by adding light to the scene.
Augmented experiences Lightweight, additive Android XR experiences that help users while they're on the go.
Visual angle Perceived size in XR; minimum readable text is 0.6 degrees (about 18sp at 1 m).

Prerequisites

  • Target compileSdk 37 or higher (compileSdk = 37 or compileSdk { version = release(37) }). Update compileSdk to 37 if lower.
  • When adding dependencies, follow the instructions in Create your first activity for intelligent eyewear:
    • androidx.xr.glimmer:glimmer (minimum 1.0.0-alpha21, or catalog alias libs.androidx.glimmer)
    • androidx.xr.glimmer:glimmer-google-fonts (minimum 1.0.0-alpha21, or catalog alias libs.androidx.glimmer.google.fonts)
    • androidx.xr.projected:projected (minimum 1.0.0-alpha13, or catalog alias libs.androidx.xr.projected or libs.androidx.projected)
    • Check gradle/libs.versions.toml first; if catalog entries exist, use them in app/build.gradle.kts and verify their versions meet the minimums. Never guess 1.0.0-alpha01 for glimmer-google-fonts.

Core constraints and limitations

  • Don't : Use MaterialTheme or Material 3 components (androidx.compose.material3.*) inside Projected Activities or Glimmer UI.
  • Do : Use GlimmerTheme and Glimmer components (androidx.xr.glimmer.*).
  • Do : Always pass createGoogleSansFlexTypography() from androidx.xr.glimmer.googlefonts as typography in GlimmerTheme.
  • Specific hardware device models or unique capabilities aren't detailed.
  • Elevation : Material 3 shadow or elevation modifiers aren't supported. Use ShadowScope or Depth tokens from Jetpack Compose Glimmer.
  • Typography limits: Minimum readable text size is 18sp (0.6°). Avoid "Thin" or "Hairline" weights, which shimmer on additive lenses.

1. Set up dependencies

  • Set up projected activity : When creating a projected activity, follow Create your first activity for intelligent eyewear and projectedcontext-source.md. Set android:requiredDisplayCategory to android.hardware.display.category.XR_PROJECTED in AndroidManifest.xml:

    <activity
        android:name="com.example.xr.projected.ProjectedMainActivity"
        android:exported="true"
        android:requiredDisplayCategory="android.hardware.display.category.XR_PROJECTED">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.XR_PROJECTED_LAUNCHER"/>
        </intent-filter>
    </activity>
    
    <br />
  • Mobile app integration : In the host phone app, add a button with Text("Launch on Glasses"). Observe ProjectedContext.isProjectedDeviceConnected(context, coroutineContext) using collectAsStateWithLifecycle(initialValue = false) to set the button's enabled state so it's disabled when glasses are disconnected. When clicked, launch GlassesMainActivity on the glasses display using ProjectedContext.createProjectedActivityOptions(context).toBundle() as shown in the following snippet:

    val options = ProjectedContext.createProjectedActivityOptions(context)
    val intent = Intent(context, ProjectedMainActivity::class.java)
    context.startActivity(intent, options.toBundle())
    
    <br />
  • UI library and font : When declaring the Glimmer, Google Fonts, and Projected artifacts in app/build.gradle.kts, follow [Declaring Jetp

Câu hỏi thường gặp

Nó cần compile SDK nào?

Dự án phải nhắm tới compileSdk 37 trở lên, và skill sẽ nâng lên nếu thấp hơn.

Nó có dành cho kính chỉ có âm thanh không?

Không. Skill dành cho kính hiển thị, còn kính AI chỉ có âm thanh mà không có màn hình thì bị loại trừ.

Activity được chiếu là gì?

Đó là activity chạy trên điện thoại và hiển thị giao diện của nó lên kính đã kết nối.

Chi tiết

Mô tả gốc của tác giả

Provides guidelines for developing projected Android XR apps for display glasses using the Jetpack Compose Glimmer UI toolkit. Covers Glimmer design principles, workflows, and interaction models for the glasses form factor. Use this skill to build an Android XR Augmented Experience app with Jetpack Compose Glimmer. Don't use for audio-only AI glasses without a display, non-glasses Android XR headsets (spatial panels or 3D volumes with Jetpack Compose for XR), or phone and tablet Material 3 UIs.

repo: android/skills

Độ phổ biến

Sao GitHub
10k
Vị trí xếp hạng
#11941
Giấy phép
Apache-2.0
Cập nhật
29/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự