Android Studio: Creating Landscape Layouts

Android Studio: Creating landscape layouts

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

Android portrait and landscape layouts

Create a layout-land folder in res folder and create xml with the same name in this folder.

Android Studio: multiple layouts, specifically landscape tablet

Click Create Other.. Select Orientation from Available Qualifiers box. Click >> button. In Screen Orientation select Landscape. In directory name paste this : layout-sw600dp-land

A new folder will be created with the same name having activity_main.xml in sw600dp(tablet 7" size) in landscape mode. Configure as per your requirement.

How to create landscape layout in Android Studio 1.4

Rightclick on your layout folder > new layout-ressource file.
The option is called Orientation in the same dialog. Right above UI Mode.

How do I specify different layouts for portrait and landscape orientations?

Create a layout-land directory and put the landscape version of your layout XML file in that directory.



Related Topics



Leave a reply



Submit