Android Screen Orientation

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:
  1. <activity  
  2.             android:name="com.example.screenorientation.MainActivity"  
  3.             android:label="@string/app_name"   
  4.             android:screenOrientation="landscape"  
  5.             />  
The common values for screenOrientation attribute are as follows:
ValueDescription
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.

No comments:

Post a Comment