Android - 运动布局语法错误:没有有效的 LayoutDescription

Dev*_*urt 4 android android-studio

当我从 ConstraintLayout 切换到 MotionLayout 时出现以下错误。我试过重建项目但没有用。

错误

布局代码:

<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" />
Run Code Online (Sandbox Code Playgroud)

</androidx.constraintlayout.motion.widget.MotionLayout>

hof*_*ord 15

您可以关闭布局文件的选项卡并重新打开它。