我为Motion Layout添加了库
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
但是MotionLayout
在布局文件中添加它无法识别布局。
Error inflating class android.support.constraint.motion.MotionLayout
我为Motion Layout添加了库
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
但是MotionLayout
在布局文件中添加它无法识别布局。
Error inflating class android.support.constraint.motion.MotionLayout
您正在导入 AndroidX/JetPack 依赖项,但使用对 MotionLayout 的旧引用。MotionLayout 类现在位于此处:
androidx.constraintlayout.motion.widget.MotionLayout
使用gradlew clean
以及清理缓存进行干净的构建:)
我也面临这个问题。我无法在动态布局的预览屏幕中看到布局设计。
我的应用程序级别的 gradle 依赖项是:
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'
布局文件是:<android.support.constraint.motion.MotionLayout ... />
当我将其更改为:androidx.constraintlayout.motion.widget.MotionLayout
它工作正常。