-1

I added a bunch of TextInputLayout wrappers to my EditText fields. I got the exception

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

What might cause this?

Niraj
  • 903
  • 8
  • 23
Andy Weinstein
  • 2,639
  • 3
  • 21
  • 32

2 Answers2

0

Another element in my constraint layout was referring previously to the id of my EditText as its reference for positioning. Had to change this to refer to the id of the TextInputLayout now containing the EditText. Android Studio does mark the reference in red in the resource file text, but I had to scroll down to see it and it doesn't say anything when I build the project (or I didn't see anything).

Andy Weinstein
  • 2,639
  • 3
  • 21
  • 32
0

Basically, you should choose the LayoutParams depending on the parent. In your case, you might have used FrameLayout.LayoutParams instead of ConstraintLayout.LayoutParams.

Niraj
  • 903
  • 8
  • 23