-1

我在我的 EditText 字段中添加了一堆 TextInputLayout 包装器。我得到了例外

ClassCastException: android.widget.FrameLayout$LayoutParams cannot be cast to androidx.constraintlayout.widget.ConstraintLayout$LayoutParams

什么可能导致这种情况?

4

2 回答 2

0

基本上,您应该选择LayoutParams取决于父母。在您的情况下,您可能已经使用FrameLayout.LayoutParams而不是ConstraintLayout.LayoutParams.

于 2019-12-18T09:39:55.790 回答
0

我的约束布局中的另一个元素之前引用了我的 EditText 的 id 作为其定位参考。必须更改它以引用现在包含 EditText 的 TextInputLayout 的 id。Android Studio 确实在资源文件文本中将引用标记为红色,但我必须向下滚动才能看到它,并且在我构建项目时它什么也没说(或者我什么也没看到)。

于 2019-12-18T09:24:16.827 回答