Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between match_parent and fill_parent?

I'm a little confused about two XML properties: match_parent and fill_parent. It seems that both are the same. Is there any difference between them?

like image 673
vnshetty Avatar asked Apr 23 '11 03:04

vnshetty


People also ask

What is the main difference between FILL_PARENT Match_parent and Wrap_content?

fill_parent and match_parent are the same, used when we want the height or width of a view to be as big as its parent view, fill_parent being deprecated. wrap_content is used when we want the view to occupy only as much space as required by it.

What does Match_parent mean?

Special value for the height or width requested by a View. MATCH_PARENT means that the view wants to be as big as its parent, minus the parent's padding, if any. Introduced in API Level 8.

What is the difference between Fill parent and match parent?

Both have similar functionality only difference is that fill_parent is used up to API level 8 and match_parent is used after API level 8 or higher level.

What does Wrap_content mean in Android?

The Android wrap_content, as the name suggests, sets a view's size to wrap_content which will only expand enough to contain the values. In simple words, the view wrapped with wrap_content will just be big enough to enclose its contents.


1 Answers

They're the same thing (in API Level 8+). Use match_parent.

FILL_PARENT (renamed MATCH_PARENT in API Level 8 and higher), which means that the view wants to be as big as its parent (minus padding)

...

fill_parent: The view should be as big as its parent (minus padding). This constant is deprecated starting from API Level 8 and is replaced by match_parent.

http://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html

like image 69
Matt Ball Avatar answered Sep 28 '22 02:09

Matt Ball