What is the difference between match_parent and fill_parent?
They are the same thing (at API Level 8+).
Yes, MATCH_PARENT and FILL_PARENT are just different constants names for the same integer value ( -1
if you're curious) used to specify the layout mode of a View
within its parent
. >
The fill_parent
was renamed to match_parent
because the problem with the old name was that it meant to affect the dimensions of parent
, while match_parent
best described the resulting behavior - corresponding dimension with parent
.
What is the function of match_parent?
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 cell phones = > Android 2.2 is advisable to use match_parent
, but for compatibility issue for previous versions there is still fill_parent
.
NOTE: In versions of the Android API 1.6 to 2.1 it is advisable to use fill_parent
because using match_parent
in these versions certain errors occur, then in these versions of API use fill_parent
.
According to the official documentation of Android itself, it specifies that they are the same thing and that there is no difference in using one or the other.
link