0

I want to set one layout for sw360dp in portrait, and one layout for sw360dp in landscape.

I have read: http://developer.android.com/guide/practices/screens_support.html#qualifiers and http://developer.android.com/training/multiscreen/screensizes.html and How do I specify different layouts for portrait and landscape orientations?

I followed the guide but I cannot make it success. I have made the following directories and layout files:

/res/layout/mylayout.xml

/res/layout-sw360dp/mylayout.xml

/res/layout-sw360dp-land/mylayout.xml

I can see on my device (a phone) with large screen that use the "layout-sw360dp" layout. However when I rotate my device to horizontal, it cannot change to show my "layout-sw360dp-land" layout, it just use the "layout-sw360dp" and rotate it horizontally.

I am using Android Studio to develop the app.

Thank you.

Community
  • 1
  • 1
eepty
  • 716
  • 3
  • 10
  • 28

2 Answers2

0

Try to read this blog explains just what you wan't to know...

res/layout-sw600dp/main_activity.xml   # For 7” tablets
res/layout-sw720dp/main_activity.xml   # For 10” tablets

res/layout-sw600dp-land/main_activity.xml   # For 7” tablets // for Landscape mode
res/layout-sw720dp-land/main_activity.xml   # For 10” tablets // for Landscape mode
0

Try removing the 's' from 'sw' and just specify the width which will change its value when you rotate the device.

Look in Table 2 under "Available screen width" for more information at https://developer.android.com/guide/practices/screens_support.html Quoting from it:

The system's corresponding value for the width changes when the screen's orientation switches between landscape and portrait to reflect the current actual width that's available for your UI.

You should get the desired effect.

Community
  • 1
  • 1
Alon
  • 601
  • 9
  • 19