The screenOrientation is the attribute of activity element. The orientation of android activity can be portrait, landscape, sensor, unspecified etc. You need to define it in the AndroidManifest.xml file. For example:

unspecifiedIt is the default value. In such case, system chooses the orientation.
portraittaller not wider
landscapewider not taller
sensororientation is determined by the device orientation sensor.

One of the key features of modern smartphones is their ability to switch screen orientation, and
Android is no exception. Android supports two screen orientations: portrait and landscape. By
default, when you change the display orientation of your Android device, the current activity that is
displayed automatically redraws its content in the new orientation. This is because the onCreate()
method of the activity is fired whenever there is a change in display orientation.

NOTE: When you change the orientation of your Android device, your current
activity is actually destroyed and then recreated.

One of the most common “solutions” to dealing with orientation changes is to not deal with them. You can do this by setting the android:configChanges flag on your Activity in AndroidManifest.xml as shown below:

    android:configChanges="orientation|screenSize|keyboardHidden" >
Subscribe To Android Learning

Subscribe To Android Learning

Join our mailing list to receive the latest android tutorials from our site.

You have Successfully Subscribed!

Pin It on Pinterest

Share This