Skip to content

Latest commit

 

History

History
36 lines (31 loc) · 1.32 KB

File metadata and controls

36 lines (31 loc) · 1.32 KB

Foco

This code is a simple test to the MotionLayout and how we could apply it.

Tech/framework used

Here I used the MotionLayout from Google, Kotlin and the project androidx..

Installation

  1. Installed the last ConstraintLayout available:
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta1'
  1. I created the MotionLayout inside the ConstraintLayout (you can create the MotionLayout as the complete activity, since MotionLayout is a ConstraintLayout child):
<androidx.constraintlayout.widget.ConstraintLayout
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto">
        ...
        <androidx.constraintlayout.motion.widget.MotionLayout
            xmlns:tools="http://schemas.android.com/tools"
            android:id="@+id/motionLayout"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layoutDescription="@xml/scene_01"
            tools:showPaths="true">
  1. Then we have to create the scene (MotionScene):
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
             xmlns:motion="http://schemas.android.com/apk/res-auto">
...