Screen Orientation Tutorial

     To make your application more responsive and improve user experience, you should create an alternative layout for landscape orientation, so that when a users device is horizontal the application layout would automatically switch to landscape layout.   
       To do that go to the res/layout directory of your project, right click the layout folder and select New->Android XML File. When a new file wizard opens, give new file the exact same name that is your main layout name (by default it is activity_main.xml) and press next (Picture 1).
Picture 1


 Now you need to configure your layout file,in the qualifier window select orientation and set screen orientation to "landscape" (Picture 2). Press finish and you are done!  

Now your res folder tree should look like this: 

res/







All you need to do is to add contents to you new layout file. Here's a little example of two layout files:

res/layout/activity_main.xml file:
res/layout-land/activity_main.xml file:
   

Demo

Portrait Orientation
Portrait Orientation

Landscape Orientation
Landscape Orientation

Source Code 


References: