Search code examples
androidxmlandroid-studioscreen-size

Android Studio multiple screen size


I'm developing an app for android devices, but i have some problems with the variety of screen sizes and different densities. So I see that before android 3.2 the solution was to create 4 folders: Small, Medium, Large and xlarge, now this method is deprecated. The problem is though running the application in similar devices the layout looks different. Which and how much folders should i do?


Solution

  • This is what I did for supporting all screen sizes, it can be a lot of work:

    Directories:

    layout-sw320dp
    layout-sw320dp-land (smallest phones, 3.7" and smaller)
    
    layout-sw360dp
    layout-sw360dp-land (approximately 4-4.7")
    
    layout-sw400dp
    layout-sw400dp-land (most phones right now, 5-6")
    
    layout-sw600dp
    layout-sw600dp-land (7-8" tablets)
    
    layout-sw720dp
    layout-sw720dp-land (9" tablets)
    
    layout-sw800dp
    layout-sw800dp-land (10" tablets)
    

    The same applies to directory names for drawables:

    drawable-sw320dp
    drawable-sw320dp-land
    

    etc etc .. that's the general idea

    Google's docs mentions sw720dp for 10" tablets but if you want separate layouts for 9" and 10" I discovered sw720dp is 9" and sw800dp is 10"