DEV Community

Cover image for Wrap_content vs Match_parent {Android Development} | Day 7
Atharva Shirdhankar
Atharva Shirdhankar

Posted on

Wrap_content vs Match_parent {Android Development} | Day 7

Alt Text

1.Match_parent :
➡️ This attribute/value is used for layout height and layout width property.
➡️ It is commonly used for ViewGroup and even sometime view.
➡️ It is used when want the width or height of the component(views) to the size of the layout(viewgroup).
➡️ And when we use match_parent for viewgroup the height and width is set to the size of the parent viewgroup (if applied to child viewgroup)or to the mobile screen (if applied to the parent viewgroup)

2. Wrap_content:
➡️ This attribute/value is used for layout height and layout width property.
➡️ It is commonly used for View and even sometime for viewgroup.
➡️ It help us to wrap the content inside of the components(view , viewgroups).

Discussion (0)