I am getting the following error when I switch to MotionLayout from ConstraintLayout. I have tried rebuilding the project but no use.
Layout Code:
<androidx.constraintlayout.motion.widget.MotionLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/fragment_death_motion_layout"
android:layout_width="match_parent"
android:layout_height="300dp"
android:layout_gravity="center"
android:layout_marginHorizontal="16dp"
android:background="@drawable/black_gray_gradient"
android:visibility="visible"
app:layoutDescription="@xml/dialog_fragment_death_scene"
tools:context=".ui.DeathDialogFragment">
<TextView
android:id="@+id/game_over_text_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="16dp"
android:text="@string/game_over"
android:textAppearance="@style/TextAppearance.AppCompat.Display1"
android:textColor="@android:color/white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.496"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/score_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:text="666"
android:textAppearance="@style/TextAppearance.AppCompat.Display3"
android:textColor="@android:color/white"
app:layout_constraintEnd_toEndOf="@+id/game_over_text_tv"
app:layout_constraintStart_toStartOf="@+id/game_over_text_tv"
app:layout_constraintTop_toBottomOf="@+id/game_over_text_tv" />
</androidx.constraintlayout.motion.widget.MotionLayout>
MotionLayout is a layout type that helps you manage motion and widget animation in your app. MotionLayout is a subclass of ConstraintLayout and builds upon its rich layout capabilities. As part of the ConstraintLayout library, MotionLayout is available as a support library and is backwards-compatible to API level 14.
You can close the layout file's tab and reopen it.
I am getting this error whenever I change the constraint layout to motion layout by editing the XML manually.
However, restarting the Android Studio has solved the problem for me.
Edit: Cutting and pasting the app:layoutDescription
attribute also seems to be fixing the issue if it repeates after you've got it working: app:layoutDescription="@xml/dialog_fragment_death_scene"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With