• Home
  • Q&A


March 30, 2012
3 score
3 answers

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


4 score

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.

answered March 30, 2012
2 score

Well they do the exact same thing, they just changed the syntax for 2.2+. I'd say just use FILL_PARENT always so that'll it always work if you plan on supporting 2.1 or lower.

answered March 30, 2012
1 score

you shouldn't use fill_parent anymore even you are supporting Android 2.1 or below. you may know java compiler will convert constants like FILL_PARENT or MATCH_PARENT to their value statically in class files. This also happens on layout XML files.

If you don't believe this, just try it on your emulator (you should declare android:minSdkVersion="4" in AndroidManifest.xml.).

answered September 01, 2012