自動填入架構
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
自動填入架構適用於 Android 8.0 (API 級別 26) 以上版本。
密碼管理工具等應用程式可以將使用者提供的資料,填入其他應用程式的檢視畫面。這類將資料填入其他應用程式檢視畫面的應用程式,通稱為「自動填入服務」。自動填入架構會管理應用程式和自動填入服務之間的通訊。
填寫表單是耗時又容易出錯的工作。自動填入架構可提供下列好處,改善使用者體驗:
- 節省填寫欄位的時間。自動填入功能可讓使用者不必重複輸入資訊。
- 盡量減少使用者在輸入時犯錯。手動輸入很容易出錯,在行動裝置上尤其是如此。減少需要手動輸入資訊的情況後,也可以一併減少錯字。
元件
自動填入架構包含下列高階元件:
- 自動填入服務:這類應用程式 (例如密碼管理工具) 會保留並儲存使用者資訊,以供在多個應用程式的檢視畫面中使用。
- 自動填入用戶端:這類應用程式會提供需要填入或保存使用者資料的檢視畫面。
- Android 系統:這個 OS 會定義工作流程,並提供支援自動填入服務和用戶端共同運作的基礎架構。
如需自動填入工作流程的詳細說明,請參閱 AutofillService
和 AutofillManager
參考說明文件。
指南
如要進一步瞭解如何使用自動填入架構,請參閱下列指南:
- 針對自動填入功能最佳化應用程式
- 確認應用程式已設為與自動填入架構搭配使用。
- 打造自動填入服務
- 實作自己的自動填入服務。
- 將自動填入功能整合到鍵盤
- 啟用鍵盤和其他輸入法編輯器,以使用自動填入功能,並讓自動填入供應商支援輸入法編輯器整合。
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-08-27 (世界標準時間)。
[null,null,["上次更新時間:2025-08-27 (世界標準時間)。"],[],[],null,["The autofill framework is available in Android 8.0 (API level 26) and higher.\n\nSome apps, such as password managers, can fill out the views in other apps with\ndata provided by the user. Apps that fill out other apps' views are called\n*autofill services*. The autofill framework manages the communication between an\napp and an autofill service.\n\nFilling out forms is a time-consuming and error-prone task. The autofill\nframework improves the user experience by providing the following benefits:\n\n- **Saving time spent filling in fields.** Autofill saves users from re-typing information.\n- **Minimizing user input errors.** Typing is prone to errors, especially on mobile devices. Minimizing the need to type information minimizes typos.\n\n| **Note:** Autofill works well with [Credential Manager](/identity/sign-in/credential-manager) and [passkeys](https://developers.google.com/identity/passkeys) to provide increased security and a smoother workflow.\n\nComponents\n\nThe autofill framework contains the following high-level components:\n\n- **Autofill services:** apps such as password managers that save and store user information that can be used in views across multiple apps.\n- **Autofill clients:** apps that provide views that need to be filled out or that hold the user's data.\n- **Android system:** the OS that defines the workflow and provides the infrastructure that makes services and clients work together.\n\nFor a detailed explanation of the autofill workflow, see the\n[`AutofillService`](/reference/android/service/autofill/AutofillService) and\n[`AutofillManager`](/reference/android/view/autofill/AutofillManager) reference\ndocumentation.\n\nGuides\n\nTo learn more about how to use the autofill framework, see the following guides:\n\n[Optimize your app for autofill](/guide/topics/text/autofill-optimize)\n: Check that your app is configured for use with the autofill framework.\n\n[Build autofill services](/guide/topics/text/autofill-services)\n: Implement your own autofill service.\n\n[Integrate autofill with keyboards](/guide/topics/text/ime-autofill)\n: Enable keyboards and other IMEs to use autofill, and enable your autofill\n provider to support IME integration."]]