I have a custom view named FloorView. I want this Floor view to be occupying the whole screen, and I need this dynamically (maybe match\_parent). I don't want to hard code the size of the view.

I've tried doing this in FloorView.kt

```
    private val rectangle = RectF(
        ViewGroup.LayoutParams.MATCH_PARENT.toFloat(),
        ViewGroup.LayoutParams.MATCH_PARENT.toFloat(), 0f, 0f)

```

I was thinking I could use the match\_parent attribute, and match the ConstraintLayout of my MainActivity, but that didn't work, nothing was drawn, possibly because the ConstraintLayout doesn't exist yet

My code for the FloorView.kt is this

```
class FloorView(context: Context, attrs: AttributeSet) : View(context, attrs) {

    private val paint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
        style = Paint.Style.FILL_AND_STROKE
        color = Color.BLACK
    }
    private val rectangle = RectF(
        ViewGroup.LayoutParams.MATCH_PARENT.toFloat(),
        ViewGroup.LayoutParams.MATCH_PARENT.toFloat(), 0f, 0f)

    override fun onDraw(canvas: Canvas?) {
        super.onDraw(canvas)
        canvas!!.drawRect(rectangle, paint)
    }

}

```

How can I make a custom view occupy all available screen space? (like match\_parent)