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?
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.
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.
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.
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.
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 bymatch_parent
.
http://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With