Creating multi-screen support app android

Jay Vyas picture Jay Vyas · Mar 29, 2014 · Viewed 29.3k times · Source

I am creating a app in Android that must support multiple screens.

For this purpose i have read many answers and one which i like most is state that i can create different folders in res folder by following name,

For small screens layout-small,

For large screens layout-large,

For extra large screens layout-xlarge

and i have to create different layouts for different screens with same name. e.g mylayout.xml

and i have to put following code in manifest.xml file

<supports-screens android:smallScreens="true" 
      android:normalScreens="true" 
      android:largeScreens="true"
      android:xlargeScreens="true"
      android:anyDensity="true" />

and finally i just need to write following lines in my Activity file,

  setContentView(R.layout.mylayout);

Now when i run this app in different size screens it should acquire layouts from different folders as per screen resolution.

But this is not happening in my case.It takes only layout that defined in layout folder.

Please can some one explains me why this happening and how can i solve this issue so that my app can run effectively on all size screens.

Answer

Arun Antoney picture Arun Antoney · Mar 29, 2014

Try out like:

  • layout-sw320dp
  • layout-sw480dp
  • layout-sw600dp
  • layout-sw720dp

instead of

  • layout-small,
  • layout-large etc...