What is the difference between match_parent and fill_parent ?
They are the same (in Level API 8+).
Yes, MATCH_PARENT and FILL_PARENT are just different constant names for the same integer value (-1
if you are curious) used to specify the layout mode of a View
within your parent
.
The fill_parent
was renamed to match_parent
because the problem with the old name was that it implied to affect the dimensions of the parent
, while match_parent
best described the resulting behaviour - the dimension corresponding to the parent
.
What is the match_parent function ?
The function of match_parent
is to give a special value to the height or width requested by a View.
Use match_parent
because there is no difference if you are in versions of API 8+,and since mobile phones => Android 2.2 is advisable to use match_parent
,but because of compatibility for previous versions still exists fill_parent
.
OBS : In Android API versions from 1.6 to 2.1 it is advisable to use fill_parent
because using match_parent
in these versions certain errors occur, so in these versions of API use fill_parent
.
According to the official documentation of Android itself, it specifies that are the same thing and that there is no difference in using either.
https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html
I appreciate the detailed explanation, I think I’m going to have to make a lot of changes so now, on the right track. =)
– Florida