Android 运动布局无法识别

Android 运动布局无法识别,android,android-layout,android-motionlayout,Android,Android Layout,Android Motionlayout,我添加了用于运动布局的库 但在布局文件中添加MotionLayout时,它无法识别布局 Error inflating class android.support.constraint.motion.MotionLayout 您正在导入AndroidX/JetPack依赖项,但使用了对MotionLayout的旧引用。MotionLayout类现在位于此处: androidx.constraintlayout.motion.widget.MotionLayout 使用gradlew clean

我添加了用于运动布局的库

但在布局文件中添加MotionLayout时,它无法识别布局

Error inflating class android.support.constraint.motion.MotionLayout

您正在导入AndroidX/JetPack依赖项,但使用了对MotionLayout的旧引用。MotionLayout类现在位于此处:

androidx.constraintlayout.motion.widget.MotionLayout


使用gradlew clean执行干净构建以清理缓存:

您正在导入AndroidX/JetPack依赖项,但使用对MotionLayout的旧引用。MotionLayout类现在位于此处:

androidx.constraintlayout.motion.widget.MotionLayout


使用gradlew clean进行干净的构建以清理缓存:

我也面临这个问题。我无法在运动布局的预览屏幕中看到布局设计

我的应用程序级渐变依赖项是:

implementation 'androidx.appcompat:appcompat:1.1.0-alpha03'
implementation 'androidx.core:core-ktx:1.1.0-alpha05'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
布局文件是:


当我把它改为:androidx.constraintlayout.motion.widget.MotionLayout时,它工作正常。

我也面临这个问题。我无法在运动布局的预览屏幕中看到布局设计

我的应用程序级渐变依赖项是:

implementation 'androidx.appcompat:appcompat:1.1.0-alpha03'
implementation 'androidx.core:core-ktx:1.1.0-alpha05'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
布局文件是:


当我将其更改为:androidx.constraintlayout.motion.widget.MotionLayout时,它工作正常。

是的,但我也添加了kolin导入,以使其正常工作。是的,我添加了kolin导入,但我也添加了kolin导入,以使其正常工作。如果使用java,您的意思是,您可以在代码中使用吗?那么是的。它的工作原理与其他布局的工作原理相同。例如:MotionLayout container=findviewbydr.id.container;button1.setOnClickListenrv->{container.setTransitionR.id.start1,R.id.end1;container.TransitionEnd;};如果说java,你的意思是你能在代码中使用吗?那么是的。它的工作原理与其他布局的工作原理相同。例如:MotionLayout container=findviewbydr.id.container;button1.setOnClickListenrv->{container.setTransitionR.id.start1,R.id.end1;container.TransitionEnd;};