title: How to set the width and height of a layout in Android?
body: <p>I have this ConstraintLayout:</p>
  <p><code>lateinit var myConstraintLayout: ConstraintLayout</code></p>
  <p>I try to set its width and height to match its parent via code, like this:</p>
  <pre><code>       val params = ConstraintLayout.LayoutParams(
              ViewGroup.LayoutParams.MATCH_PARENT,
              ViewGroup.LayoutParams.MATCH_PARENT
          )
          myConstraintLayout.setLayoutParams(params)
  </code></pre>
  <p>But I get error <code>androidx.constraintlayout.widget.ConstraintLayout$LayoutParams cannot be cast to android.widget.FrameLayout$LayoutParams</code> Why? How do I fix this?</p>