Creating multi-screen support app android

Solution 1:

Try out like:

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

instead of

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

Solution 2:

Please refer below link:

http://developer.android.com/guide/practices/screens_support.html For Different screen size, The following is a list of resource directories in an application that provides different layout designs for different screen sizes and different bitmap drawables for small, medium, high, and extra high density screens. you could use different size of the layout files in res folder and also vary for drawable images based on the density..

  res/layout/my_layout.xml             // layout for normal screen size ("default")
  res/layout-small/my_layout.xml       // layout for small screen size
  res/layout-large/my_layout.xml       // layout for large screen size
  res/layout-xlarge/my_layout.xml      // layout for extra large screen size
  res/layout-xlarge-land/my_layout.xml // layout for extra large in landscape orientation

enter image description here res/drawable-mdpi/my_icon.png // bitmap for medium density res/drawable-hdpi/my_icon.png // bitmap for high density res/drawable-xhdpi/my_icon.png // bitmap for extra high density

<compatible-screens>
    <screen
        android:screenDensity="ldpi"
        android:screenSize="small" />
    <screen
        android:screenDensity="mdpi"
        android:screenSize="normal" />
    <screen
        android:screenDensity="xhdpi"
        android:screenSize="large" />
    <screen
        android:screenDensity="xhdpi"
        android:screenSize="xlarge" />        
</compatible-screens>

And followed by any activity use this lines..

android:configChanges="orientation|screenSize|keyboardHidden"

Solution 3:

In values folder naming convention like layout-small only works for devices with api version less than 3.1. You should create values file with naming like layout-sw600dp for api level greater than 3.1. read this http://developer.android.com/guide/practices/screens_support.html3.1api

enter image description here like this you should create layout-sw600dp, layout-sw720dp for each type of devices. layout-sw600dp means this layout works for devices with smallest width of 600dp If you have layout-600dp and layout-sw720dp folders. first layout folder works for devices with smallest width of 600dp(7 inch tablet) to 720dp and second works for devices with smallest width above 720dp(10 inch tablet).

If your minimum required version is above 3.1 you don't need have layout-small, layoutxLarge folders. otherwise you have to consider both type of layout fromats.