1

I'm developing an app using Eclipse. I'm trying to get as large as almost all android screen sizes. I searched alot on google and youtube and the only way I found and understood is that to choose in making a new layout qualifiers which are Small,Medium, Large, and xlarge. The problem I'm facing is with the normal category, when I choose the preview from galaxy nexus to nexus 4, the location of the button changes. their Height and Width unit is DP. and the Galaxy Nexus and Nexus 4 falls under the normal Category I think. Is there any manual way to develop for specified phone screen size and add them to the layout? I don't care how hard it is I'm ready to add all android screen sizes to the list.

Thanks in advance.

  • why dont you create the layout programmatically after you determine the screen size of the device in your code? – dsharew Dec 04 '14 at 14:55
  • Try to use `LinearLayout` instead of `RelativeLayout`. Check this two links. [Link-1](http://android-developers.blogspot.com.tr/2009/02/android-layout-tricks-1.html), [Link-2](http://stackoverflow.com/questions/4905370/what-are-the-differences-between-linearlayout-relativelayout-and-absolutelayou) – Batuhan Coşkun Dec 04 '14 at 14:56

1 Answers1

1

ANDROID SUPPORTING MULTIPLE SCREEN For supporting multiple screen,you need to create different layout for diff screen size. Support all screen you need to create following layout and put them each folder. Here is the different folder structure that you need to create.

Low density Small screens QVGA 240×320 (120dpi):

layout-small-ldpi (240x320)

layout-small-land-ldpi (320x240) Low density Normal screens WVGA400 240×400 (x432) (120dpi):

layout-ldpi (240 x 400 )

layout-land-ldpi (400 x 240 ) Medium density Normal screens HVGA 320×480 (160dpi):

layout-mdpi (320 x 480 )

layout-land-mdpi (480 x 320 ) Medium density Large screens HVGA 320×480 (160dpi):

layout-large-mdpi (320 x 480 )

layout-large-land-mdpi (480 x 320) Tablet ( 240 dpi ):

layout-sw600dp for tablet 7inch

layout-sw720dp for tablet 10inch

or

layout-large (600 x 1024)

layout-large-land (1024 x 600)

High density Normal screens WVGA800 480x800 (x854) (240 dpi):

layout-hdpi (480 x 800)

layout-land-hdpi (800 x 480)

Xoom (medium density large but 1280x800 res) (160 dpi):

layout-xlarge (800 x 1280)

layout-xlarge-land (1280 x 800) Also you should add following lines in .manifest file:

<supports-screens                                 

    android:smallScreens="true"                   

    android:normalScreens="true"        

    android:largeScreens="true"           

    android:xlargeScreens="true"            

    android:anyDensity="true" />

Its all that you need do. Now your app will run smoothly in all devices.

Sarath Kumar
  • 1,922
  • 3
  • 19
  • 43