Search code examples
androidandroid-screen-support

Supporting Multiple Screens in android?


In my application, I am setting multiple screen support. In my layout am using layout-normal it supports 320x480 and 480X720hdpi(I think, because it takes it from layout-normal)every layout fit to both resolution perfectly, But pop up window not fit for 480X720 resolution.

Please refer my image 320x480 screen image and 480x720 screen image will know the problem. How to solve the problem.

320X480 Screen

480x720 Screen

1.320X480 Screen 2.480x720 Screen


Solution

  • Add you layout to every folder like

    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
    

    In Manifest add support-screens

    <supports-screens android:resizeable=["true"| "false"]
                      android:smallScreens=["true" | "false"]
                      android:normalScreens=["true" | "false"]
                      android:largeScreens=["true" | "false"]
                      android:xlargeScreens=["true" | "false"]
                      android:anyDensity=["true" | "false"]
                      android:requiresSmallestWidthDp="integer"
                      android:compatibleWidthLimitDp="integer"
                      android:largestWidthLimitDp="integer"/>
    

    For more info check this link