3

我想使用 MotionLayout 但我的应用程序在 AndroidX 中,我尝试使用通常的 XML 标签但它们不起作用。布局编辑器只显示一个带有标签名称的灰色框。我如何在 AndroidX 中使用 MotionLayout,或者如果这不可能,你可以给我一个替代方案。

谢谢 :)

它现在也发生在 GridLayout 上。以下是截图:

在此处输入图像描述在此处输入图像描述

这很奇怪。网格布局的代码:

<androidx.gridlayout.widget.GridLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content>

</androidx.gridlayout.widget.GridLayout>
4

2 回答 2

1

MotionLayout已添加到 ConstraintLayout 2.0,因此请确保您有

implementation 'androidx.constraintlayout:constraintlayout:$androidConstraintLayoutVersion'

在您的应用程序build.gradle$androidConstraintLayoutVersion至少有 2.0

于 2019-12-30T22:26:44.733 回答
0

没有代码很难说,但请确保您的 xml 标记是正确的: <androidx.constraintlayout.motion.widget.MotionLayout ...>

于 2019-03-22T20:21:06.210 回答