การกำหนดภาพเคลื่อนไหวที่กำหนดเอง
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
หน้านี้เลิกใช้งานแล้ว ดูตำแหน่งใหม่ของ
เอกสารที่เคยอยู่ที่นี่ได้ที่ด้านล่าง
ปรับแต่งการตอบสนองต่อการสัมผัส
การตอบสนองต่อการแตะใน Material Design จะเป็นการยืนยันด้วยภาพทันที ณ จุดสัมผัสเมื่อผู้ใช้โต้ตอบกับองค์ประกอบ UI ภาพเคลื่อนไหวการตอบสนองต่อการแตะเริ่มต้น
สำหรับปุ่มใช้คลาส RippleDrawable
ใหม่ ซึ่งเปลี่ยน
ระหว่างสถานะต่างๆ ด้วยเอฟเฟกต์ระลอกคลื่น
ในกรณีส่วนใหญ่ คุณควรใช้ฟังก์ชันนี้ใน XML ของมุมมองโดยระบุพื้นหลังของมุมมอง
เป็นดังนี้
?android:attr/selectableItemBackground
สำหรับการกระเพื่อมที่จำกัด
?android:attr/selectableItemBackgroundBorderless
สำหรับการกระเพื่อมที่ขยายออกไปนอก
มุมมอง โดยจะอิงตามและถูกจำกัดด้วยองค์ประกอบระดับบนสุดที่ใกล้ที่สุดของมุมมองที่มีพื้นหลังที่ไม่ใช่ Null
หมายเหตุ: selectableItemBackgroundBorderless
เป็นแอตทริบิวต์ใหม่
ที่เปิดตัวใน API ระดับ 21
หรือจะกำหนด RippleDrawable
เป็นทรัพยากร XML โดยใช้องค์ประกอบ ripple
ก็ได้
คุณกำหนดสีให้กับออบเจ็กต์ RippleDrawable
ได้ หากต้องการเปลี่ยนสีการตอบสนองต่อการสัมผัสเริ่มต้น ให้ใช้แอตทริบิวต์ android:colorControlHighlight
ของธีม
ดูข้อมูลเพิ่มเติมได้ที่การอ้างอิง API สำหรับคลาส RippleDrawable
ใช้เอฟเฟกต์การเปิดเผย
ดูหัวข้อสร้างภาพเคลื่อนไหวแบบวงกลม
ปรับแต่งการเปลี่ยนภาพกิจกรรม
ดูเริ่มกิจกรรมด้วยภาพเคลื่อนไหว
ใช้การเคลื่อนไหวแบบโค้ง
ดูหัวข้อใช้การเคลื่อนไหวแบบโค้ง
เปลี่ยนสถานะมุมมองให้เคลื่อนไหว
ดูการใช้ StateListAnimator เพื่อ
เปลี่ยนสถานะของมุมมอง
สร้างภาพเคลื่อนไหวของ Vector Drawable
ดูสร้างภาพเคลื่อนไหวของกราฟิกที่ถอนออกได้
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา 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,["# Defining Custom Animations\n\n**This page is deprecated.** See below for the new location for\ndocumentation that used to be here.\n\nCustomize Touch Feedback\n------------------------\n\nTouch feedback in material design provides an instantaneous visual confirmation at the\npoint of contact when users interact with UI elements. The default touch feedback animations\nfor buttons use the new [RippleDrawable](/reference/android/graphics/drawable/RippleDrawable) class, which transitions\nbetween different states with a ripple effect.\n\nIn most cases, you should apply this functionality in your view XML by specifying the view\nbackground as:\n\n- `?android:attr/selectableItemBackground` for a bounded ripple.\n- `?android:attr/selectableItemBackgroundBorderless` for a ripple that extends beyond the view. It will be drawn upon, and bounded by, the nearest parent of the view with a non-null background.\n\n**Note:** `selectableItemBackgroundBorderless` is a new\nattribute introduced in API level 21.\n\nAlternatively, you can define a [RippleDrawable](/reference/android/graphics/drawable/RippleDrawable)\nas an XML resource using the `ripple` element.\n\nYou can assign a color to [RippleDrawable](/reference/android/graphics/drawable/RippleDrawable) objects. To change\nthe default touch feedback color, use the theme's `android:colorControlHighlight`\nattribute.\n\nFor more information, see the API reference for the [RippleDrawable](/reference/android/graphics/drawable/RippleDrawable) class.\n\nUse the Reveal Effect\n---------------------\n\nSee [Create a circular reveal animation](/training/animation/reveal-or-hide-view#Reveal).\n\n\nCustomize Activity Transitions\n------------------------------\n\nSee [Start an Activity with an Animation](/training/transitions/start-activity).\n\nUse Curved Motion\n-----------------\n\nSee [Use curved motion](/training/animation/reposition-view#CurvedMotion).\n\nAnimate View State Changes\n--------------------------\n\nSee [Using StateListAnimator to\nanimate view state changes](/guide/topics/graphics/prop-animation#ViewState).\n\nAnimate Vector Drawables\n------------------------\n\nSee [Animate Drawable Graphics](/guide/topics/graphics/drawable-animation)."]]