Set zero height to constraintLayout child programmatically

134 views Asked by At

How can I set the height of a ConstraintLayout child to be 0dp? When I use layoutParams and do the following, ConstraintLayout thinks 0dp = match_parent

        val layoutParams = view.layoutParams.apply {
            this.height = newHeight
        }
        view.layoutParams = layoutParams

So if newHeight is 0 here, it thinks it's match_parent

I would like to avoid checking for 0 and if true set it to a negative value

0

There are 0 answers