Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FILL_PARENT and MATCH_PARENT [duplicate]

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)?

like image 462
bassicplays Avatar asked Mar 30 '12 19:03

bassicplays


People also ask

What is the difference between Match_parent and Fill_parent?

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.

What is the main difference between Fill_parent Match_parent and Wrap_content?

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.

What does the Match_parent value indicate?

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.

What is Fill_parent?

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)


1 Answers

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.

like image 148
noob Avatar answered Oct 03 '22 05:10

noob