Creating a self-contained MotionScene
The only difference between the main structure of the self-contained MotionScene
and the one we saw before is that the ConstraintSets
are described in this file instead of just referring to the layout IDs
Let's create a new MotionScene
called motion_scene_detail.xml
. For now let's copy-paste the same MotionLayout
we created for the Main Activity (motion_scene_main.xml
)
We're not going to use the gesture handler so we can delete that. Additionally, instead of setting our constraints from the layout we mentioned that we're going to include our constraints here. To do so we need to specify aConstraintSet
for the start and one for the end. Inside those ConstraintSets
we'll include the Constraint
s of our view(s). To add the "spin" we will add to our Constraint
a rotation attribute.
Once you're done you'll have again to add it as a layoutDescription
in the item layout XML.
Last updated