Justin Watkins Justin Watkins -5 years ago 116
Android Question

How many times does ConstraintLayout measure each of its children?

RelativeLayout measures all its children twice. This can cause performance issues. Does constraint layout only measure its children once each?

Answer Source

ConstraintLayout requires two measure passes.

If you look at the ConstraintLayout's source, you'll see that its onMeasure() method first measures its children inside an internalMeasureChildren() utility method. Next, it evaluates some constraints. Finally, ConstraintLayout calls child.measure() on its children a second time inside a loop.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download