5

I'm developing an app which should work on a phone and on a tablet device. I tested it on the emulator and it worked fine. But when I start it on a real Samsung Tab, it uses the phone layouts. What qualifiers should I use in order to get the tablet using tablets layouts ? I tried with layout-sw600dp but it doesn't work.

Thanks !

abecker
  • 885
  • 1
  • 10
  • 15
  • Are you sure, in your XML file is assigned for tablet (ie.Go to Graphical Layour->10.1in WXGA (Tablet)) – Aerrow Sep 22 '12 at 06:49

2 Answers2

7

Layout selection in Android devices is as follows

layout -> Default (Useful for Phone layouts), layout-large - > 5" to 7" tablets (like Galaxy Note, Kindle Fire etc), layout-xlarge -> above 7" tablets, layout-swdp -> regardless of the screen's current orientation, your application's has at least dps of width available for it UI.(Introduced in Android 3.2 and above , this may be the reson why 600dp dint work for you).

For more details http://developer.android.com/guide/practices/screens_support.html

MGK
  • 7,050
  • 6
  • 34
  • 41
  • I had this same problem, it is solved making folder and keeping layouts and images in layout-xlarge and drawable-xlarge respectively. – Muhammad Irfan Apr 11 '13 at 06:45
0

would have put this as comment, since it only completes the answer of Santosh, but i have no right to comment :)

since i lost some nerves over it (sorry if i am too dumb), having my app ignore the alternative layout-x folders and so as to spare others, and since its not written explicitely in the android docs/tutorial about different screen sizes (a link reminding this would have been nice...) , if in your manifest you have not this type of directive, all the above won't work.....

<supports-screens android:resizeable="true"
            android:smallScreens="true"
            android:normalScreens="true"
            android:largeScreens="true"
            android:xlargeScreens="true"
            android:anyDensity="true"
    />
Noh Kumado
  • 35
  • 2
  • 9