iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
In Android layouts, wrap_content asks a view to take enough space for its content and its own padding. match_parent asks it to take the space its parent allows, minus the parent’s padding. Set width and height independently; the result also depends on the parent layout.
How the two values differ
| Value | What it requests | Use it when |
|---|---|---|
wrap_content |
Enough room to enclose the view’s content, including the view’s padding. | The view should size itself around text, a drawable, or other internal content. |
match_parent |
The size available from the parent, after accounting for the parent’s padding. | The view should occupy the available space in that parent dimension. |
Android describes match_parent as making a view “as big as its parent (minus padding).” The parent still measures and constrains its child, so this value does not promise that a view will fill the physical screen. Android Developers: ViewGroup.LayoutParams
Choose width and height separately
The values are set independently in android:layout_width and android:layout_height. A view can wrap its width while matching its parent’s height, or use any other combination that suits the layout. Android’s layout resource documentation shows both attributes accepting dimensions, match_parent, or wrap_content. Android Developers: Layout resource
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent" />
For example, this requests a width based on the text and the space the parent permits vertically. The final measured size still depends on the parent’s rules.
#1 Best Overall
Why the parent layout matters
Layout parameters are interpreted by the parent. In most cases, match_parent means the child requests all of the parent’s available space in that dimension, but a particular parent layout can apply its own measurement and sizing rules.
ConstraintLayout
In ConstraintLayout, 0dp means “match constraint”: the view uses the space available within its constraints. Android’s responsive views guidance describes this as similar to match_parent, but bounded by the constraints. The same guidance recommends responsive sizing such as wrap_content, match_parent, or 0dp (match constraint) instead of hard-coded dimensions when adapting to different display sizes. Android Developers: Responsive/adaptive design with views
Rank #2
GridLayout
GridLayout does not distinguish MATCH_PARENT from WRAP_CONTENT for its children. Its flexibility rules control expansion, so changing a child’s value to match_parent alone may not make it expand as expected. Android Developers: GridLayout.LayoutParams
Practical selection guide
- Choose
wrap_contentwhen a control should be only as large as its content requires, such as a short label or button. - Choose
match_parentwhen a view should use the available width or height of its parent, subject to that parent’s behavior. - In
ConstraintLayout, use0dpwhen the view should fill the space defined by its constraints. - Prefer these responsive values over fixed dimensions when the layout must accommodate different display sizes.
What does fill_parent mean?
fill_parent is the older name for match_parent. Android’s ViewGroup.LayoutParams reference marks FILL_PARENT deprecated and replaced by MATCH_PARENT; it records MATCH_PARENT as introduced in API level 8. Use match_parent in current examples and code. Android Developers: ViewGroup.LayoutParams
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.

