Android 未找到MotionLayout类或未找到属性layoutDescription
我正试图遵循谷歌的MotionLayout教程,但似乎无法构建项目,甚至无法找到类 这是xmlAndroid 未找到MotionLayout类或未找到属性layoutDescription,android,xml,gradle,android-motionlayout,Android,Xml,Gradle,Android Motionlayout,我正试图遵循谷歌的MotionLayout教程,但似乎无法构建项目,甚至无法找到类 这是xml <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://sc
<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:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutDescription="@xml/step1_completed">
<ImageView
android:id="@+id/red_star"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@drawable/ic_star_outline"
android:tint="?colorSecondary"
android:contentDescription="@string/star"
android:layout_marginTop="30dp"
android:layout_marginStart="30dp"
android:layout_marginBottom="30dp"
android:layout_marginEnd="30dp"/>
</androidx.constraintlayout.motion.widget.MotionLayout>
这是我试着跑步时得到的
AAPT: error: attribute layoutDescription (aka com.google.samples.motionlayoutcodelab:layoutDescription) not found.
感谢使用AndroidX版本的依赖项:
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta4'
使用依赖项的AndroidX版本:
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta4'