Creating a self-contained MotionScene : Solution
motion_scene_detail.xml
<?xml version="1.0" encoding="utf-8"?>
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:motion="http://schemas.android.com/apk/res-auto">
<Transition
motion:constraintSetStart="@+id/start"
motion:constraintSetEnd="@+id/end"
motion:duration="1000"
android:interpolator="@android:anim/accelerate_decelerate_interpolator" />
<ConstraintSet android:id="@+id/start">
<Constraint
android:id="@+id/iv_added_item"
android:layout_width="42dp"
android:layout_height="42dp"
android:layout_margin="8dp"
android:rotation="-360"
motion:layout_constraintBottom_toBottomOf="parent"
motion:layout_constraintStart_toStartOf="parent"
motion:layout_constraintTop_toTopOf="parent" />
</ConstraintSet>
<ConstraintSet android:id="@+id/end">
<Constraint
android:id="@+id/iv_added_item"
android:layout_width="42dp"
android:layout_height="42dp"
android:layout_margin="8dp"
android:rotation="360"
motion:layout_constraintBottom_toBottomOf="parent"
motion:layout_constraintEnd_toEndOf="parent"
motion:layout_constraintTop_toTopOf="parent" />
</ConstraintSet>
</MotionScene>
If you get a warning about multiple IDs you can remove the '+' from the ID in the Constraints tag: android:id="@id/iv_added_item"
li_detail.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.motion.MotionLayout
...
app:layoutDescription="@xml/motion_scene_detail">
...
</android.support.constraint.motion.MotionLayout>
PreviousCreating a self-contained MotionSceneNextAdding animations in the RecyclerView items: Step 1
Last updated