Skip to content
Skillpedia
Mobile apps10k · #11936

glance-canonical-layouts

What it does

This skill copies standard widget layouts from Android's sample project into your app, using Jetpack Glance. Layouts include check lists, image grids, snap scrolling and standard toolbars. It is for Android developers building home screen widgets.

When to use it

  • ✓When you want a home screen widget with a check list or a grid of images.
  • ✓When you need a standard widget toolbar or snap scrolling layout for your Android app.
  • ✓When a new widget does not appear in the widget picker and you need to check its registration.

Skill link

https://github.com/android/skills/blob/main/system/glance-canonical-layouts/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/android/skills/blob/main/system/glance-canonical-layouts/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

Example of what to ask your AI

“Add a check list widget to my Android app using the standard Glance layout.”

5 new skills a week. 1 minute to read.

How it works

The skill copies the chosen layout's reference files into your app and updates the package names and imports. It removes unused parts and registers the widget receiver in the manifest so it appears in the picker.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

To implement a widget Canonical Layout that follows the recommended design patterns:

  1. The project MUST use Jetpack Glance.
  2. You MUST locate the requested layout from the list under Canonical Layout Reference Files.
  3. Copy the layout reference files into your project's target app module (e.g., src/main/java/ and src/main/res/) in one step to implement the exact design and reduce the number of tool calls.
  4. You MUST set override val sizeMode: SizeMode = SizeMode.Exact in the widget provider class.
  5. Validate that your project compiles, updating sample package declarations, import paths, and class names to match the target app's package name.
  6. Clean your project's widget code, removing unused classes (for example, unused buttons).
  7. You MUST register the widget receiver in AndroidManifest.xml inside <application> after <activity>, ensuring android:resource="@xml/..." matches the filename of the copied Widget Info XML. Otherwise, the widget won't appear in the widget picker:
<br />
<receiver android:name=".glance.MyReceiver"
    android:exported="true">
    <intent-filter>
        <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
    </intent-filter>
    <meta-data
        android:name="android.appwidget.provider"
        android:resource="@xml/my_app_widget_info" />
</receiver>
<br />

Dependencies

Add Jetpack Glance dependencies to the app module's build.gradle.kts (dependencies block):

  • androidx.glance:glance-appwidget:1.2.0 or higher
  • androidx.glance:glance-material3:1.2.0 or higher
  • androidx.glance:glance-appwidget-preview:1.2.0 or higher
  • androidx.glance:glance-preview:1.2.0 or higher

Use version 1.3.0-alpha02 or higher with compileSdk = 37 and Android Gradle Plugin (AGP) 9.1.0 or higher (for example, agp = "9.1.0" in gradle/libs.versions.toml) when implementing Snap Scrolling.

If copying sample data repositories that load bitmaps with Coil (such as FakeImageGridDataRepository.kt, FakeImageTextListDataRepository.kt, or FakeTextWithImageRepository.kt), also add an image loading library dependency such as io.coil-kt:coil (e.g., implementation("io.coil-kt:coil:2.7.0")) if one doesn't already exist.

Canonical layout reference files

Action list layout (action_list)

FAQ

Why is my widget missing from the picker?

The receiver must be registered in the manifest with the matching widget info file, and the skill checks this.

Does it need Jetpack Glance?

Yes. The project must use Jetpack Glance for these layouts.

What size mode does it use?

The skill sets the widget's size mode to exact in the widget provider class.

Details

Original description by the author

Use this skill to create home screen widgets using Jetpack Glance Canonical Layouts from the Android Platform Samples project, or when asked to implement standard widget layout patterns (including Check List, Image Grid, Snap Scrolling, and Standard Toolbar).

repo: android/skills

Popularity

GitHub stars
10k
Ranking position
#11936
License
Apache-2.0
Updated
10/29/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills