自 2025 年 3 月 27 日起,我們建議您使用 android-latest-release
而非 aosp-main
建構及貢獻 AOSP。詳情請參閱「Android 開放原始碼計畫變更」。
總覽
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
AppCard 是使用者介面元素群組,樣式由原始設備製造商 (OEM) 控制,並填入應用程式提供的資訊。AppCard 會以易於存取且隨時可用的方式,向使用者顯示應用程式最相關的資料和功能。

圖 1. AppCard 元件。
第三方開發人員可使用 AppCards 執行下列操作:
- 在司機前往餐廳途中,向對方顯示外帶餐點訂單狀態。
- 在車輛中向乘客展示相片,營造愉悅的氛圍。
- 追蹤並定期更新投資人的加密貨幣價格。
例如:

圖 2. AppCard 範例。
AppCard
來源: AppCard.kt
AppCard 是保存資料的物件。我們支援具有兩種狀態的 ImageAppCard
。定義任何類型的 AppCard 時,每個元件都必須有專屬 ID。
圖 3. 含有文字的圖片。
|
圖 4. 進度列和含有文字的按鈕。
|
AppCard ContentProvider
來源: AppCardContentProvider.kt
應用程式中存在的內容供應者,會建立 AppCard,並與 AppCardHost
建立例項及通訊。詳情請參閱「AppCardContentProviderExtension」。
AppCard Host
來源: AppCardHost.kt
這個系統應用程式會連線至 AppCardContentProvider
,顯示及管理應用程式資訊卡。詳情請參閱「設定 AppCard 主機」。
AppCard Context
來源: AppCardContext.kt
這個物件會向 AppCardContentProvider
提供有關 AppCardHost
如何顯示 AppCard 的提示。AppCardContext
包含下列資訊:
- API 級別
重新整理週期:
- 完成 AppCard 更新
- 標記為
EnforceFastUpdateRate
的 AppCard 元件
主機是否支援與 AppCard 互動?
圖片大小上限:
預期顯示的按鈕數量下限。
AppCard 開發人員可根據這項資訊,最佳化傳送至主機的資訊。
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-27 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-07-27 (世界標準時間)。"],[],[],null,["# Overview\n\nAn *AppCard* is a grouping of UI elements with styling controlled by the OEM,\nand populated with information provided by apps. AppCards display an app's most\nrelevant data and functionality to users in a way that is accessible and always\navailable.\n\n**Figure 1.** AppCard components.\n\nThird-party developers can use AppCards to:\n\n- Display the status of a takeout food order to a driver while en route.\n- Show photos to passengers in vehicles to form a pleasant ambiance.\n- Track and periodically update the price of crypto coins for investors.\n\nExamples include:\n\n**Figure 2.** AppCard examples.\n\nAppCard\n-------\n\n**Source:** [`AppCard.kt`](https://android.googlesource.com/platform/packages/apps/Car/libs/+/refs/tags/ub-automotive-master-20250418/car-app-card-lib/app-card/src/main/java/com/android/car/appcard/AppCard.kt)\n\nAn AppCard is an object that holds data. We support an `ImageAppCard`, that has\ntwo states. When defining any type of AppCard, each component must have a\nunique ID.\n\n|--------------------------------|---------------------------------------------------|\n| **Figure 3.** Image with text. | **Figure 4.** Progress bar and buttons with text. |\n\nAppCard ContentProvider\n-----------------------\n\n**Source:** [`AppCardContentProvider.kt`](https://android.googlesource.com/platform/packages/apps/Car/libs/+/refs/tags/ub-automotive-master-20250418/car-app-card-lib/app-card/src/main/java/com/android/car/appcard/AppCardContentProvider.kt)\n\nA content provider that exists in an app, creates AppCards, and is instantiated\nand communicates with `AppCardHost`. To learn more, see\n[AppCardContentProviderExtension](/docs/automotive/unbundled_apps/appcards/appcard#override).\n\nAppCard Host\n------------\n\n**Source:** [`AppCardHost.kt`](https://android.googlesource.com/platform/packages/apps/Car/libs/+/refs/tags/ub-automotive-master-20250418/car-app-card-host-lib/app-card-host/src/main/java/com/android/car/appcard/host/AppCardHost.kt)\n\nA system app that connects to `AppCardContentProvider`(s) to display and manage\nApp Cards. To learn more, see [Configure an AppCard host](/docs/automotive/unbundled_apps/appcards/host).\n\nAppCard Context\n---------------\n\n**Source:** [`AppCardContext.kt`](https://android.googlesource.com/platform/packages/apps/Car/libs/+/refs/tags/ub-automotive-master-20250418/car-app-card-lib/app-card/src/main/java/com/android/car/appcard/AppCardContext.kt)\n\nAn object that provides hints to an `AppCardContentProvider` about how an\n`AppCardHost` might display an AppCard. `AppCardContext` contains this\ninformation:\n\n- API level\n- Refresh period for:\n\n - Complete AppCard updates\n - AppCard components tagged with `EnforceFastUpdateRate`\n- Is the host to support interactions with AppCard?\n\n- Maximum image size:\n\n - Center image\n - Button image\n - Header image\n- Minimum number of buttons expected to be displayed.\n\nThis information allows AppCard developers to optimize the information sent to\nhosts."]]