Android 7.1 範例
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
以下程式碼範例適用於 Android 7.1 (API 25)。如要在 Android Studio 中下載範例,請依序選取「File」>「New」>「Import Sample」選單選項。
注意:這些可下載的專案專為搭配 Gradle 和 Android Studio 使用而設計。
應用程式捷徑範例
這個範例示範如何使用 Android 7.1 (API 級別 25) 中推出的 應用程式捷徑 API。這個 API 可讓應用程式定義一組意圖,在使用者長按應用程式的啟動器圖示時顯示。我們會提供範例,說明如何在 XML 中以靜態方式註冊連結,以及在執行階段以動態方式註冊連結。
應用程式捷徑範例
圖片鍵盤應用程式範例
本範例示範如何使用 Android 支援資料庫實作
Commit Content API。這個 API 可讓 IME 以通用方式,將圖片或其他多媒體內容直接傳送至應用程式中的文字編輯器,讓使用者使用自訂表情符號、貼圖或其他應用程式提供的多媒體內容來撰寫內容。
圖片鍵盤應用程式範例
圖片鍵盤輸入法範例
本範例示範如何使用
Commit Content API 和 Android 支援程式庫,編寫自訂圖片鍵盤。這個鍵盤會顯示在相容的應用程式中 (同樣使用 Commit Content API),讓使用者在文字編輯器中插入表情符號、貼圖或其他富內容。
圖像鍵盤輸入法範例
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。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,["# Android 7.1 Samples\n\nThe following code samples are provided for Android 7.1 (API 25). To\ndownload the samples in Android Studio, select the **File \\\u003e New \\\u003e Import Sample** menu\noption.\n\n\n**Note:** These downloadable projects are designed\nfor use with Gradle and Android Studio.\n\n### App shortcuts sample\n\n\nThis sample demonstrates how to use the [app shortcuts API](/guide/topics/ui/shortcuts)\nintroduced in Android 7.1 (API level 25). This API allows an application to define a set of\nintents which are displayed when a user long-presses on the app's launcher icon. Examples are\ngiven for registering links both statically in XML, as well as dynamically at runtime.\n\n\n[App shortcuts sample](https://github.com/android/user-interface-samples/tree/main/AppShortcuts)\n\n### Image keyboard app sample\n\n\nThis sample demonstrates how to implement the [Commit Content API](/reference/android/view/inputmethod/InputConnection#commitContent(android.view.inputmethod.InputContentInfo,%20int,%20android.os.Bundle)), using the [Android Support Library](/topic/libraries/support-library).\nThis API provides a universal way for IMEs to send images and other rich\ncontent directly to a text editor in an app, allowing users to compose\ncontent using custom emojis, stickers, or other rich content provided by\nother applications.\n\n\n[Image keyboard app sample](https://github.com/android/input-samples/tree/main/CommitContentSampleApp)\n\n### Image keyboard IME sample\n\n\nThis sample demonstrates how to write a [custom image keyboard](/preview/image-keyboard) using the [Commit Content API](/reference/android/view/inputmethod/InputConnection#commitContent(android.view.inputmethod.InputContentInfo,%20int,%20android.os.Bundle)) and the [Android Support Library](/topic/libraries/support-library).\nThis keyboard will be displayed inside compatible apps (also using the Commit\nContent API), allowing users to insert emojis, stickers, or other rich\ncontent into text editors.\n\n\n[Image keyboard IME sample](https://github.com/android/input-samples/tree/main/CommitContentSampleIME)"]]