Android Studio: Creating landscape layouts

You can also use option given in below image.

enter image description here

I hope you have understood.


You can actually use layout-land in Android Studio as well it will show up in your res directory like so:

layout-land

If it doesn't show up make sure to have your project scope set to Project and not Android.

Project Scope

If you still don't see one you can create one by right clicking on the res directory and selecting New -> Android resource directory and filling out the prompt below.

New directory

Also, once it's been created, you can easily switch from portrait to landscape in the layout preview via the orientation button found on the toolbar above the layout preview. It is pictured below:

Orientation Toggle


The accepted answer is actually seriously outdated. In Android Studio 3.x.x, there is no need to create an extra layout folder (I am not sure this was necessary back then anyway).

There is also no need to change the project scope from Android to Project as the accepted answer tells you to.

There is also no need to edit any UI attributes and modes as the accepted answer says.

There are just 2 steps:

1) Open your base UI layout in DESIGN mode so that you see the actual GUI, such as buttons, icons etc. (do NOT open it as text, in the XML code view mode).

2) Click the icon marked in the below screenshot and, from the menu, select Create Landscape Variation (marked in the screenshot as 'Click 2nd').

Then, the Studio does all the job for you and it works like a charm. No need to add any extra code and no extra folders are created.

Enjoy.

Android Studio 3.1.4:

enter image description here


MrEngineer13's answer is spot on.

The only thing that I would add is that his screenshot may lead you to believe that you should be selecting 'UI Mode' from the 'Available qualifiers' list.

Just to clarify: after filling out the Directory name and Resource type, select 'Orientation' from Available qualifiers, which will lead you to the screenshot that MrEngineer13 provided.