What is the difference between match_parent and fill_parent? What is the difference between match_parent and fill_parent? android android

What is the difference between match_parent and fill_parent?


They're the same thing (in API Level 8+). Use 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)

...

fill_parent: The view should be as big as its parent (minus padding). This constant is deprecated starting from API Level 8 and is replaced by match_parent.

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


Google changed the name to avoid confusion.

Problem with the old name fill parent was that it implies its affecting the dimensions of the parent, while match parent better describes the resulting behavior - match the dimension with the parent.

Both constants resolve to -1 in the end, and so result in the identical behavior in the app. Ironically enough, this name change made to clarify things seems to have added confusion rather than eliminating it.


Functionally no difference, Google just changed the name from fill_parent to match_parent, from API level 8 (Android 2.2). FILL_PARENT is still available for compatibility reason.

LayoutParams.FILL_PARENT and LayoutParams.MATCH_PARENT both have value -1. Not sure what tempted google to change from Fill Parent to Match Parent :)

Since most of the phones are >= Android 2.2 .. you should use Match Parent for future compatibility... not sure when they will discontinue the older Fill Parent constant!