Reputation: 713
What was the reason behind introducing match_parent and deprecating fill_parent since both mean the same thing. won't this change be a hindrance to backward compatibility?
Upvotes: 8
Views: 7805
Reputation: 713
Using match_parent instead of fill_parent will NOT make the generated APK unrunnable in older versions because in the generated APK the occurrence of match_parent's and fill_parent's will be replaced with their corresponding Constant Value, which is same in this case (both are -1), so same APK can run on older versions of Android platform as well.
But while compiling the code if you switch to older version (version 7 or below) then you will get a compilation error (since match_parent is not defined in version 7 or below).
Upvotes: 10
Reputation: 2808
Android Doc says:
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.
So They are the same as their values are both -1. But if you worry about the backward compatibility, you can go here: platfrom version
this give you a better idea on when you should change all your fill_parent to match_parent. as of now, it seems 50% ppl are using API Level 8 or above. So it's up to you to change it.
Upvotes: 4