Is the obsolete word the only difference between fill_parent and match_parent

I found that both fill_parent and match_parent mean the same thing

  • fill_parent means that the view wants to be as large as its parent, minus the parent complement, if any.
  • match_parent means that the view wants to be as large as its parent, minus the parent complement, if any.

The only difference I found is that fill_parent deprecated since API level 8 and is replaced by match_parent

However, I did not notice any difference between the two. If both are the same, then why fill_parent deprecated. Can someone explain any differences between the two, except that one of them is outdated and the other is not?

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

+58
android
Dec 15 '11 at 7:57
source share
4 answers

As you said, they are exactly the same. As Romain Guy said, they changed the name because "fill_parent" confused for developers. Due to the fact that "fill_parent" does not fill the remaining space (for this you use the weight attribute), but it takes up as much space as its parent layout. Therefore, the new name "match_parent" .

+77
Dec 15 '11 at 8:03
source share

According to Romain Guy in this video, these words indicate the same behavior. But many developers misunderstood what fill_parent means, so they came up with an alias.

+9
Dec 15 '11 at 8:02
source share

I developed Android long enough to realize that there seems to be no difference except when you want to run the older API. I would use fill_parent because I am making all my applications with a minimum API of 7. Also, on the other hand, since Android is cutting-edge compatible, this is the way to go.

+7
Dec 15 '11 at 8:01
source share

Supplement existing answers. This is part of the source code for the LayoutParams class, and the constants FILL_PARENT and MATCH_PARENT are mapped to the same value. Thus, we have exactly the same functionality.

  public static class LayoutParams { /** * Special value for the height or width requested by a View. * FILL_PARENT means that the view wants to be as big as its parent, * minus the parent padding, if any. This value is deprecated * starting in API Level 8 and replaced by {@link #MATCH_PARENT}. */ @SuppressWarnings({"UnusedDeclaration"}) @Deprecated public static final int FILL_PARENT = -1; /** * 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 padding, if any. Introduced in API Level 8. */ public static final int MATCH_PARENT = -1; ... 
+3
Mar 18 '15 at 15:02
source share



All Articles