joy joy - 7 months ago 42
Android Question

Multiple Screen Size support for android?

I am creating a simple

in android with some customized buttons(not the ones android provides by default).The image appears proper on screen size 2.7 to 5.1. However
appear stretched on screen size 5.4 and greater (tried till screen size 7).I have made four same images named them similarly of different densities and placed them correspondingly in the folders
.I need to know whether i need to create different
for different screens?Or android picks up images automatically from the corresponding folders?Some body please guide me as i am new to android on this as i am struggling to create
targeting android mobile devices.


No need of defining different layout folders(layout-land, layout-large, layout-small) if u designed layouts consistently. The Android OS will take care of that(regarding images display). Only thing you have to do is add the <support-screens> in your manifest and below is the <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"]

Tips for Creating consistent layouts:

  1. Dont hard-code any layout parameters such as width,height,etc..
  2. Dont use "px".Use "sp" for Text Size and "dp" for layout-width, layout-height etc.
  3. Make use of RelativeLayout and LinearLayout and dont use AbsoluteLayout as it is deprecated.
  4. Use ScrollView wherever required for layouts as it supports for a singleView.

For more information check the Android Developer documents of Support Multiple Screens.