Right now I am using MATCH_PARENT all throughout my app. I've decided to make the app available to Android 2.1 users but the MATCH_PARENT is not introduced till Android 2.2
How should I go about doing this if I want my app to use MATCH_PARENT when the Android version is 2.2 and above but use FILL_PARENT if it's 2.1 (or lower if I decide to open it to them later on)?
Both have similar functionality only difference is that fill_parent is used up to API level 8 and match_parent is used after API level 8 or higher level.
fill_parent and match_parent are the same, used when we want the height or width of a view to be as big as its parent view, fill_parent being deprecated. wrap_content is used when we want the view to occupy only as much space as required by it.
match_parent is used for referring to the parent size either through layout_width or layout_height attributes. If we set layout_height as match_parent then the view's height will be as same as the parent's height.
It's used to set a View or Layouts size based on either it's contents or the size of it's parent layout rather than explicitly specifying a dimension. fill_parent (deprecated and renamed MATCH_PARENT in API Level 8 and higher)
FILL_PARENT
and MATCH_PARENT
are same thing, if the version the user is having is 2.2 or higher FILL_PARENT
would be replaced by MATCH_PARENT
automatically. So it's better to use FILL_PARENT
, to support backward compatibility.
There was a blog on Android dev site about this, I hope you can find it, if you want to have more details on this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With