با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
Android Studio شامل یک ویرایشگر طراحی بصری برای نوع طرح بندی MotionLayout است که ساخت و پیش نمایش انیمیشن ها را آسان تر می کند.
Motion Editor یک رابط ساده برای دستکاری عناصر از کتابخانه MotionLayout ارائه می دهد که به عنوان پایه ای برای انیمیشن در برنامه های اندروید عمل می کند. بدون Android Studio، ایجاد و تغییر این عناصر نیاز به ویرایش دستی محدودیتها در فایلهای منبع XML دارد. با این حال، Motion Editor میتواند این XML را با پشتیبانی از حالتهای شروع و پایان، فریمهای کلیدی، انتقالها و جدول زمانی برای شما ایجاد کند.
مطابق شکل زیر روی Convert to MotionLayout کلیک کنید.
پس از اینکه Android Studio ConstraintLayout شما را به MotionLayout تبدیل کرد، یک فایل Motion Scene (یک فایل .xml با _scene که به نام فایل طرح بندی شما اضافه شده است) نیز به دایرکتوری حاوی XML شما اضافه می شود.
سپس MotionLayout تبدیل به طرح اصلی شما می شود و در رابط کاربری Motion Editor ظاهر می شود. این طرح از قبل شامل یک ConstraintSet شروع، پایان ConstraintSet ، و یک انتقال از ابتدا به پایان است.
میتوانید از گرافیک نمای کلی برای انتخاب یک ConstraintSet یا Transition و برای انتخاب مؤلفهها در پانل انتخاب استفاده کنید.
سپس میتوانید محدودیتها و ویژگیهای ConstraintSet شروع یا پایان را به همان روشی که ConstraintLayout ویرایش میکنید، ویرایش کنید.
اگر میخواهید عناصر بیشتری در نمودار خود بسازید، میتوانید از نمادهای ایجاد برای اضافه کردن سریع حرکات ConstraintSet ، Transition یا OnClick / OnSwipe استفاده کنید.
برای افزودن یک فریم کلیدی، ابتدا روی فلش Transition کلیک کنید:
سپس، در قسمت Transition Timeline، روی گوشه سمت راست بالا کلیک کنید و KeyPosition را انتخاب کنید:
این عمل یک گفتگو را باز می کند که در آن می توانید ویژگی هایی را برای فریم کلیدی تنظیم کنید.
همچنین میتوانید کنترلکنندههای OnClick و OnSwipe را به Transition در پانل ویژگی اضافه کنید.
این عمل یک گفتگو را باز می کند که در آن می توانید ویژگی های کلیک مانند اجزای هدف و جهت کشیدن را تنظیم کنید.
Motion Editor از پیش نمایش انیمیشن ها در سطح طراحی پشتیبانی می کند. هنگامی که یک انیمیشن انتخاب شد، روی Play کلیک کنید بالای جدول زمانی برای پیش نمایش انیمیشن.
محتوا و نمونه کدها در این صفحه مشمول پروانههای توصیفشده در پروانه محتوا هستند. جاوا و OpenJDK علامتهای تجاری یا علامتهای تجاری ثبتشده Oracle و/یا وابستههای آن هستند.
تاریخ آخرین بهروزرسانی 2025-07-29 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","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-29 بهوقت ساعت هماهنگ جهانی."],[],[],null,["# Build animation with the Motion Editor\n\nAndroid Studio includes a visual design editor for the\n[MotionLayout](/training/constraint-layout/motionlayout) layout type, making it\neasier to create and preview animations.\n\nThe Motion Editor provides a simple interface for manipulating elements from the\nMotionLayout library that serves as the foundation for animation in Android\napps. Without Android Studio, creating and altering these elements requires\nmanually editing constraints in XML resource files. The Motion Editor, however,\ncan generate this XML for you, with support for start and end states, keyframes,\ntransitions, and timelines.\n| **Note:** Before using the Motion Editor, be sure to set the `ConstraintLayout` dependency in your `build.gradle` file to version `2.0.0-beta3`, as described in the MotionLayout [reference documentation](/training/constraint-layout/motionlayout#getting_started).\n\nTo get started with the Motion Editor:\n\n1. [Create a ConstraintLayout](/training/constraint-layout#add-constraintlayout-to-your-project).\n2. Right-click on the preview in the Layout Editor.\n3. Click **Convert to MotionLayout**, as shown below.\n\nAfter Android Studio converts your ConstraintLayout to MotionLayout, a Motion\nScene file (an `.xml` file with `_scene` appended to your layout filename) is\nalso added to the directory containing your XML.\n\nThe `MotionLayout` then becomes your root layout, and it appears in the Motion\nEditor UI. The layout already includes a start `ConstraintSet`, end\n`ConstraintSet`, and a transition going from start to end.\n\nYou can use the overview graphic to select a `ConstraintSet` or\n`Transition` and to select components on the selection panel.\n\nThen you can edit the constraints and attributes of either the start or end\n`ConstraintSet` the same way you would edit a `ConstraintLayout`.\n\nIf you want to build more elements to your graph, you can use the creation\nicons to quickly add a `ConstraintSet`, `Transition`, or `OnClick`/`OnSwipe`\ngestures.\n\nTo add a keyframe, first click on the **Transition** arrow:\n\nThen, in the **Transition** timeline pane, click on the top-right corner and\nselect **KeyPosition**:\n\nThis action opens a dialog where you can set attributes for the keyframe.\n\nYou can also add `OnClick` and `OnSwipe` handlers to the Transition in the\nattribute panel.\n\nThis action opens a dialog where you can set attributes of the click such as\ntarget components and drag direction.\n\nThe Motion Editor supports previewing animations on the design surface. When an\nanimation is selected, click **Play**\n\nabove the timeline to preview the animation."]]