3

I have a problem regarding my app.I have created tab bar using image button,when I run the app in 480*800 hdpi device the tab bar images are displaying perfectly when I run in 240*320 device the images in image button are not displaying properly.I have created the drawable folders and added the images also

drawable
drawable-hdpi
drawable-ldpi
drawable-mdpi
drawable-xhdpi
Cœur
  • 37,241
  • 25
  • 195
  • 267

3 Answers3

3

Try following scenario of layout. I found at http://jamil.fluidsoul.net/2011/03/06/creating-android-applications-for-multiple-screen-sizes.

Low density Small screens QVGA 240x320 (120dpi):

layout-small-ldpi (240x320)  
layout-small-land-ldpi (320x240)

Low density Normal screens WVGA400 240x400 (x432) (120dpi):

layout-ldpi  (240 x 400 )
layout-land-ldpi  (400 x 240 )

Medium density Normal screens HVGA 320x480 (160dpi):

layout-mdpi (320 x 480 )
layout-land-mdpi (480 x 320 )

Medium density Large screens HVGA 320x480 (160dpi):

layout-large-mdpi (320 x 480 )
layout-large-land-mdpi (480 x 320)

Galaxy Tab ( 240 dpi ):

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)

If outcome display in Graphical layout best matches with all other, you will get same output in original device also.

Chintan Rathod
  • 25,864
  • 13
  • 83
  • 93
  • you should. If view display is different what you want. Otherwise there is also other way you can find at http://stackoverflow.com/questions/14108074/layouts-on-different-models-of-mobiles/14108211#14108211 – Chintan Rathod Mar 12 '13 at 07:09
  • i have created layout,layout-normal,layout-large..but still its not working,i have to put the same layout for every screen right –  Mar 12 '13 at 07:15
  • as per your question, you should have 2 layout like layout-small and layout. Two are sufficient to do all work. If not working, something goes wrong in your code because I use this scenario in my application and it works fine for me. – Chintan Rathod Mar 12 '13 at 07:19
  • i have one doubt that i can use the same layout for each and every layout folder.. –  Mar 12 '13 at 07:24
  • depends. If its normal screen, you can. But I faced problem in large and xlarge screen due to more resolutions and screen sized then normal and small screen. – Chintan Rathod Mar 12 '13 at 08:22
  • @ranjith thanks for update.. Might be domain is no more exist. Answer was posted 2 years back.. :( – Chintan Rathod Aug 07 '15 at 07:44
1

For detail, please refer to Android Developer Guide.

To summarize, you must declare each supporting screen sizes in your AndroidManifest.xml. For example, you have to include the following:

<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"/>

To support 240*320, you must do the following:

1: In AndroidManifest.xml, include

<supports-screens android:smallScreens="true" />

2: Create different layout-small folder:

res/layout/layout-small/

3: Create drawable-ldpi folder (you already did):

res/drawable-ldpi/
melvynkim
  • 1,655
  • 3
  • 25
  • 38
  • though i have used the layout,layout small it does not make any change –  Mar 12 '13 at 06:55
0

You have to read below document first:- http://developer.android.com/guide/practices/screens_support.html

or

Is there a list of screen resolutions for all Android based phones and tablets?

above also hope use full to you.

Community
  • 1
  • 1
duggu
  • 37,851
  • 12
  • 116
  • 113
  • though i have used the layout,layout small it doesnot make any change –  Mar 12 '13 at 06:56