Search code examples
androidxmlscreen-resolution

how to support multiple screen in an android app if it contain more than one XMl file


I am working on an app having multiple XML files.I modified manifest as

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

Made layout folders for different different densities but only xml which I am copying on these folders are working. Other XMLs are still lacking.


Solution

  • Add following folders on res and copy same xml to each other.

    Customize each xml file for each resolution

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

    sw means "smalles width"

    layout-sw320dp - small phones.  - devices with width grater than 320 dp
    layout-sw480dp - large phones   - devices with width grater than 480 dp
    layout-sw600dp - 7inch tablets    - devices with width grater than 600 dp
    layout-sw720dp - 10 inch tablets    - devices with width grater than 720 dp
    

    Read this article https://developer.android.com/guide/practices/screens_support.html