In android, every application is designed in almost both the orientations i.e Portrait and Landscape. By default Android Studio gives you the option to design your application in Portrait mode but for Landscape we need to make some extra settings or more specifically, we need to add/create a Landscape Layout folder under res folder. As per Android developer website guide lines the name of this folder should be “layout-land”.
How to Add / Create Landscape Layout in Android Studio
Lets see how to create layout-land inside your project:
Step 1: Open your Android Studio and if your project is opened in “Android” perspective then change it to “Project” Perspective(Option is available on the Left side of your android studio)
Step 2: Open App folder inside your project folder
Step 3: Then open src > main >res. Here you have all the folder which help in creating UI for your app.
Step 4: Right click on res folder click New>Directory. Android studio will open a dialog box.
Step 5: Inside Dialog box you have to give a directory name or you can say name of our new folder. So it would be “layout-land”. Click Ok.
Step 7: Cut layout xml file
Step 8: Paste it under your “layout-land” folder and click ok. Now open your xml file. You will get the Landscape mode.