ภาพเคลื่อนไหวและการเปลี่ยน
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ลองใช้ Compose
Jetpack Compose เป็นชุดเครื่องมือ UI ที่แนะนำสำหรับ Android ดูวิธีเพิ่มภาพเคลื่อนไหวใน Compose
เมื่อ UI เปลี่ยนแปลงเพื่อตอบสนองต่อการกระทำของผู้ใช้ คุณควรสร้างภาพเคลื่อนไหวให้กับการเปลี่ยนเลย์เอาต์
ภาพเคลื่อนไหวเหล่านี้จะให้ความคิดเห็นแก่ผู้ใช้เกี่ยวกับการกระทำของตนเอง และช่วยให้ผู้ใช้ทราบถึงตำแหน่งของตนเองใน UI
Android มีเฟรมเวิร์กการเปลี่ยนฉาก ซึ่งช่วยให้คุณสร้างภาพเคลื่อนไหวการเปลี่ยนแปลงระหว่างลำดับชั้นของ 2 มุมมองได้อย่างง่ายดาย
เฟรมเวิร์กจะสร้างภาพเคลื่อนไหวของมุมมองที่รันไทม์โดย
เปลี่ยนค่าพร็อพเพอร์ตี้บางอย่างเมื่อเวลาผ่านไป เฟรมเวิร์กนี้มีภาพเคลื่อนไหวในตัว
สำหรับเอฟเฟกต์ทั่วไป และช่วยให้คุณสร้างภาพเคลื่อนไหวที่กำหนดเองและการเรียกกลับสำหรับวงจรการเปลี่ยนได้
หากต้องการเริ่มต้นใช้งาน ให้ดูวิดีโอที่ฝังอยู่ที่นี่และอ่านภาพรวมของภาพเคลื่อนไหว
วิดีโอ
แหล่งข้อมูลเพิ่มเติม
ดูข้อมูลเพิ่มเติมเกี่ยวกับการเคลื่อนไหวได้จากแหล่งข้อมูลต่อไปนี้
วิดีโอ
ตัวอย่าง
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา 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,["# Animations and Transitions\n\nTry the Compose way \nJetpack Compose is the recommended UI toolkit for Android. Learn how to add animations in Compose. \n[Animations in Compose →](/jetpack/compose/animation) \n\nWhen your UI changes in response to user action, you should animate the layout transitions.\nThese animations give users feedback on their actions and help keep them oriented to the UI.\n\nAndroid includes the *transitions framework*, which enables you to easily\nanimate changes between two view hierarchies. The framework animates the views at runtime by\nchanging some of their property values over time. The framework includes built-in animations\nfor common effects and lets you create custom animations and transition lifecycle callbacks.\n\nTo get started, watch the video embedded here and read the\n[Animations Overview](/training/animation/overview). \n\nDocumentation\n-------------\n\n- [Animations Overview](/training/animation/overview)\n- [Property Animation Overview](/guide/topics/graphics/prop-animation)\n- [Animate drawable graphics](/guide/topics/graphics/drawable-animation)\n- [Reveal or hide a view using animation](/training/animation/reveal-or-hide-view)\n- [Move a View with Animation](/training/animation/reposition-view)\n- [Move views using a fling animation](/guide/topics/graphics/fling-animation)\n- [Enlarge a view using a zoom animation](/training/animation/zoom)\n- [Animate movement using spring physics](/guide/topics/graphics/spring-animation)\n- [Auto animate layout updates](/training/animation/layout)\n- [Animate layout changes using a transition](/training/transitions)\n- [Create a custom transition animation](/training/transitions/custom-transitions)\n- [Start an activity using an animation](/training/transitions/start-activity)\n- [Slide between fragments using ViewPager](/training/animation/screen-slide)\n- [Slide between fragments using ViewPager2](/training/animation/screen-slide-2)\n- [Migrate from ViewPager to ViewPager2](/training/animation/vp2-migration) \n\nVideos\n------\n\nAdditional resources\n--------------------\n\n\nFor more information about animation,\nconsult the following resources.\n\n### Video\n\n- [Get Animated (Android Dev Summit '18)](https://www.youtube.com/watch?v=N_x7SV3I3P0): Overview of the various animation technologies available. Includes a summary of [how to choose\n between the different animation options](https://www.youtube.com/watch?v=N_x7SV3I3P0&t=2265).\n\n### Samples\n\n- [Navigation\n \\\u003e Shared element](https://github.com/android/animation-samples/tree/main/Motion/app/src/main/java/com/example/android/motion/demo/sharedelement)\n- [Navigation\n \\\u003e Fade through](https://github.com/android/animation-samples/tree/main/Motion/app/src/main/java/com/example/android/motion/demo/navfadethrough)\n- [Layout\n \\\u003e Fade through](https://github.com/android/animation-samples/tree/main/Motion/app/src/main/java/com/example/android/motion/demo/fadethrough)\n- [more...](/training/animation/additional-resources)"]]