0

I have a ConstraintLayout and I'm adding a maxHeight constraint by using constraintSet.constrainMaxHeight(R.id.recyclerView, (Utils.getScreenHeight() / 2.2).toInt())

Later in my excecution I need to remove this max height constraint, so I do:

constraintSet.connect(R.id.recyclerView, TOP, PARENT, TOP)
constraintSet.constrainHeight(R.id.recyclerView, MATCH_CONSTRAINT)
constraintSet.constrainMaxHeight(R.id.liveFeedRecyclerView, UNSET)

However, my recyclerView still has the "max height" assigned to it. What is the proper way of unsetting the max height constraint and setting my view's height to Match Constraint?

P.S.: All the Constant values are the constants found in the ConstraintSet class.

Lucas P.
  • 4,282
  • 4
  • 29
  • 50

1 Answers1

1

It looks like ConstraintLayout defaults the max height to Integer.MAX_VALUE (decimal value is 2147483647), so try using that instead of UNSET which is -1.

enter image description here

Cheticamp
  • 61,413
  • 10
  • 78
  • 131