Android: alternate layout xml for landscape mode


How can I have one layout for landscape and one for portrait? I want to assume extra width and conserve vertical space when the user rotates the phone over sideways.

2/1/2011 1:32:27 AM

Accepted Answer

By default, the layouts in /res/layout are applied to both portrait and landscape.

If you have for example


you can add a new folder /res/layout-land, copy main.xml into it and make the needed adjustments.


See also and for some more options.

10/5/2012 11:34:57 PM

In the current version of Android Studio (v1.0.2) you can simply add a landscape layout by clicking on the button in the visual editor shown in the screenshot below. Select "Create Landscape Variation"

Android Studio add landscape layout

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow