Free tools Windows power users keep installed
One-click scans. No signup required.
wrap_content sizes a view to fit its content and its own padding; match_parent asks for the space available from its immediate parent, after the parent’s padding is accounted for. Set width and height independently. The right choice depends on the space the view should occupy and on how its parent measures children.
What each value means
| Value | What it requests | Use it when |
|---|---|---|
wrap_content |
Enough space to enclose the view’s content, including the view’s own padding. | The view should size to its text, drawable, or other internal content. |
match_parent |
The size available from the parent, minus the parent’s padding. | The view should occupy the available space in that dimension. |
Android’s ViewGroup.LayoutParams reference describes match_parent as: “The view should be as big as its parent (minus padding).” This is a request interpreted through the parent layout’s measurement rules, not a guarantee that the child will fill the physical screen.
As an Amazon Associate I earn from qualifying purchases.
How to choose width and height
The two values are independent. Android’s layout resource documentation allows each of android:layout_width and android:layout_height to use a dimension, match_parent, or wrap_content.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →- Choose
wrap_contentfor a dimension that should follow the content, such as a button whose width follows its label. - Choose
match_parentwhen the view should use the parent’s available width or height. - Mix them when appropriate: a view can use
match_parentfor width andwrap_contentfor height, or the reverse.
For example, a label might need content-sized height while spanning the width available from its parent. The choice for one dimension does not dictate the choice for the other.
#1 Best Overall
Why the parent layout matters
A view does not size itself in isolation. The immediate parent measures and constrains its child, so the result depends on both the requested value and the parent’s rules. In particular, match_parent means the parent’s available size—not automatically the device’s full screen.
ConstraintLayout
In ConstraintLayout, 0dp means “match constraints”: the view uses the space available within its constraints. Android’s responsive and adaptive design guidance presents wrap_content, match_parent, and 0dp (match constraint) as responsive alternatives to hard-coded dimensions.
Rank #2
GridLayout
Do not assume that switching a child to match_parent will make it expand in a GridLayout. Android’s GridLayout.LayoutParams documentation says that GridLayout does not distinguish MATCH_PARENT from WRAP_CONTENT for children; expansion is governed by its flexibility principle.
What about fill_parent?
fill_parent is the older name, now deprecated in favor of match_parent. Android’s ViewGroup.LayoutParams reference records MATCH_PARENT as introduced in API level 8 and marks FILL_PARENT deprecated starting at API level 8. Use match_parent in current examples; when reading older XML, treat fill_parent as the legacy equivalent.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




