KG6ZVP KG6ZVP - 1 year ago 171
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)

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