Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is deprecated word the only difference between fill_parent and match_parent

Tags:

android

I found that both fill_parent and match_parent means the same thing

  • fill_parent means that the view wants to be as big as its parent, minus the parent's padding, if any.
  • match_parent means that the view wants to be as big as its parent, minus the parent's padding, if any.

The only difference that I found is that fill_parent is deprecated starting from API Level 8 and is replaced by match_parent

However, I didn't notice any difference between these two. If both are the same then, why is fill_parent deprecated. Can anyone explain any differences between these two except for the fact that one is deprecated and the other isn't?

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

like image 445
Sunil Kumar Sahoo Avatar asked Dec 15 '11 07:12

Sunil Kumar Sahoo


People also ask

What is difference between Wrap_content and 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) WRAP_CONTENT, which means that the view wants to be just big enough to enclose its content (plus padding)

What is Match_parent?

match_parent and fill_parent are same property, used to define width or height of a view in full screen horizontally or vertically. These properties are used in android xml files like this. android:layout_width="match_parent" android:layout_height="fill_parent"

Is fill parent deprecated?

FILL_PARENT is deprecated. Being deprecated does not make it the Devil, but eventually it will go away. Your application is more future-proof using MATCH_PARENT .


1 Answers

As you said they are exact the same. As Romain Guy said, they have changed the name because "fill_parent" was confusing for developers. As matter of the fact, "fill_parent" does not fill the remaining space (for that you use the weight attribute) but it takes as much space as its layout parent. That's why the new name is "match_parent".

like image 126
gwvatieri Avatar answered Sep 25 '22 10:09

gwvatieri