What is the difference between match_parent and fill_parent?

9

When editing the xml layout I always get confused when choosing between match_parent and fill_parent , and I end up always thinking that I'm doing everything wrong because I do not know what each one is or if they are the same .

Could anyone explain what the functionality of each?

    
asked by anonymous 22.06.2016 / 20:03

4 answers

14

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

    
22.06.2016 / 20:14
2

Basically, none. Both are the same. Documentation link here

fill_parent was renamed to match_parent in API 8 and higher. Try to always use match_parent

    
22.06.2016 / 20:09
2

In practice, there is no difference.

match_parent replaced fill_parent from API Level 8 .

See the Android documentation:

    
22.06.2016 / 20:09
2

fill_parent is no longer used, it is deprecated.

It has been replaced by match_parent, you can even use fill_parent , but there may be some "flaws" in the application.

So it's better to use the current same as macth_parent .

    
22.06.2016 / 20:09