ตัวอย่าง Android 7.1
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
โค้ดตัวอย่างต่อไปนี้มีไว้สำหรับ Android 7.1 (API 25) หากต้องการดาวน์โหลดตัวอย่างเพลงใน Android Studio ให้เลือกตัวเลือกเมนูไฟล์ > ใหม่ > นําเข้าตัวอย่างเพลง
หมายเหตุ: โปรเจ็กต์ที่ดาวน์โหลดได้เหล่านี้ออกแบบมาเพื่อใช้กับ Gradle และ Android Studio
ตัวอย่างทางลัดของแอป
ตัวอย่างนี้แสดงวิธีใช้ App Shortcuts API ที่เปิดตัวใน Android 7.1 (API ระดับ 25) API นี้ช่วยให้แอปพลิเคชันกำหนดชุด Intent ที่แสดงเมื่อผู้ใช้กดไอคอน Launcher ของแอปค้างไว้ มีตัวอย่างการลงทะเบียนลิงก์ทั้งแบบคงที่ใน XML และแบบไดนามิกที่รันไทม์
ตัวอย่างทางลัดของแอป
ตัวอย่างแอปแป้นพิมพ์รูปภาพ
ตัวอย่างนี้แสดงวิธีใช้
Commit Content API โดยใช้ Android Support Library
API นี้ให้วิธีสากลสำหรับ IME ในการส่งรูปภาพและเนื้อหาอื่นๆ แบบริชมีเดียไปยังเครื่องมือแก้ไขข้อความในแอปโดยตรง ซึ่งช่วยให้ผู้ใช้เขียนเนื้อหาได้โดยใช้อีโมจิ สติกเกอร์ หรือเนื้อหาอื่นๆ แบบริชมีเดียที่ปรับแต่งเองซึ่งแอปพลิเคชันอื่นๆ มีให้
ตัวอย่างแอปแป้นพิมพ์รูปภาพ
ตัวอย่าง IME ของแป้นพิมพ์รูปภาพ
ตัวอย่างนี้แสดงวิธีเขียนแป้นพิมพ์รูปภาพที่กําหนดเองโดยใช้
Commit Content API และAndroid Support Library
แป้นพิมพ์นี้จะแสดงในแอปที่เข้ากันได้ (ซึ่งใช้ Commit Content API ด้วย) ซึ่งช่วยให้ผู้ใช้แทรกอีโมจิ สติกเกอร์ หรือเนื้อหาอื่นๆ แบบริชมีเดียลงในเครื่องมือแก้ไขข้อความได้
ตัวอย่าง IME ของแป้นพิมพ์รูปภาพ
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา Java และ OpenJDK เป็นเครื่องหมายการค้าหรือเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-27 UTC
[[["เข้าใจง่าย","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 UTC"],[],[],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)"]]