KG6ZVP KG6ZVP - 10 months ago 105
Android Question

Set width to match constraints in ConstraintLayout

I would like to constrain a View's left and right sides to it's parent view's margins and make it fill the allotted space. However, setting width to either

appears to produce the same result.

Is there something equivalent to match_constraints (as opposed to match_parent and wrap_content)? Do
affect the layout or are they ignored in the new constraint layout?

Loving this new layout system for my favorite platform!

Answer Source

match_parent is supported, but it is not as powerful as 0dp. With 0dp, you can think of your constraints as 'scalable' rather than 'filling whats left'.

Also, 0dp can be defined by a position, where match_parent relies on it's parent for it's position (x,y and width, height)