รองรับตัวควบคุมเกม
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
คุณปรับปรุงประสบการณ์ของผู้ใช้ในเกมได้โดยอนุญาตให้
ผู้เล่นใช้เกมคอนโทรลเลอร์ เฟรมเวิร์ก Android
มี API สำหรับตรวจหาและประมวลผลอินพุตของผู้ใช้จาก
เกมคอนโทรลเลอร์
คู่มือนี้แสดงวิธีทำให้เกมทำงานร่วมกับเกม
คอนโทรลเลอร์ได้อย่างสอดคล้องกันใน Android API ระดับต่างๆ (API ระดับ 9 ขึ้นไป) และ
วิธีปรับปรุงประสบการณ์การเล่นเกมสำหรับผู้เล่นโดยรองรับคอนโทรลเลอร์หลายตัว
พร้อมกันในแอป
หมายเหตุ:
หากคุณกำลังพัฒนาเกมหรือเขียนแอป C++ ให้ใช้
ไลบรารี Game Controller
ซึ่งเป็นส่วนหนึ่งของ
Android Game Development Kit (AGDK) แทน
บทเรียน
-
จัดการการดำเนินการของตัวควบคุม
-
ดูวิธีจัดการอินพุตของผู้ใช้จากองค์ประกอบอินพุตทั่วไปในเกม
คอนโทรลเลอร์ ซึ่งรวมถึงปุ่มแผงควบคุมทิศทาง (D-pad), ปุ่มเกมแพด
และจอยสติ๊ก
-
รองรับตัวควบคุมใน Android เวอร์ชันต่างๆ
-
ดูวิธีทำให้ตัวควบคุมเกมทำงานเหมือนกันในอุปกรณ์ต่างๆ
ที่ใช้ Android เวอร์ชันต่างๆ
-
รองรับตัวควบคุมเกมหลายตัว
-
ดูวิธีตรวจหาและใช้ตัวควบคุมเกมหลายตัวที่เชื่อมต่อพร้อมกัน
-
ฟีเจอร์เพิ่มเติมของเกมคอนโทรลเลอร์
-
ดูวิธีใช้ฟีเจอร์เพิ่มเติมของคอนโทรลเลอร์
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา 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,["# Support game controllers\n\nYou can enhance the user experience in your game by letting\nplayers use game controllers. The Android framework\nprovides APIs for detecting and processing user input from game\ncontrollers.\n\n\nThis guide shows how to make your game work consistently with game\ncontrollers across different Android API levels (API level 9 and up) and\nhow to enhance the gaming experience for players by supporting multiple\ncontrollers simultaneously in your app.\n\n**Note:**\nIf you are developing games or writing a C++ app, use the\n[Game Controller Library](/games/sdk/game-controller)\nthat is part of the\n[Android Game Development Kit (AGDK)](/games/agdk) instead.\n\nLessons\n-------\n\n\n**[Handle controller actions](/develop/ui/views/touch-and-input/game-controllers/controller-input)**\n:\n Learn how to handle user input from common input elements on game\n controllers, including directional pad (D-pad) buttons, gamepad buttons,\n and joysticks.\n\n\n**[Support controllers across Android versions](/develop/ui/views/touch-and-input/game-controllers/compatibility)**\n:\n Learn how to make game controllers behave the same across devices\n running different versions of Android.\n\n\n**[Support multiple game controllers](/develop/ui/views/touch-and-input/game-controllers/multiple-controllers)**\n:\n Learn how to detect and use multiple game controllers that are\n simultaneously connected.\n\n\n**[Additional game controller features](/develop/ui/views/touch-and-input/game-controllers/controller-features)**\n:\n Learn how to use additional controller features."]]