2012年1月31日 星期二

Change Activity Orientation

// Activity support screen orientation
"unspecified"  The default value. The system chooses the orientation. The policy it uses, and therefore the choices made in specific contexts, may differ from device to device.
"user"  The user's current preferred orientation.
"behind"  The same orientation as the activity that's immediately beneath it in the activity stack.
"landscape"  Landscape orientation (the display is wider than it is tall).
"portrait"  Portrait orientation (the display is taller than it is wide).
"reverseLandscape"  Landscape orientation in the opposite direction from normal landscape. Added in API level 9.
"reversePortrait"  Portrait orientation in the opposite direction from normal portrait. Added in API level 9.
"sensorLandscape"  Landscape orientation, but can be either normal or reverse landscape based on the device sensor. Added in API level 9.
"sensorPortrait"  Portrait orientation, but can be either normal or reverse portrait based on the device sensor. Added in API level 9.
"sensor"  The orientation is determined by the device orientation sensor. The orientation of the display depends on how the user is holding the device; it changes when the user rotates the device. Some devices, though, will not rotate to all four possible orientations, by default. To allow all four orientations, use "fullSensor".
"fullSensor"  The orientation is determined by the device orientation sensor for any of the 4 orientations. This is similar to "sensor" except this allows any of the 4 possible screen orientations, regardless of what the device will normally do (for example, some devices won't normally use reverse portrait or reverse landscape, but this enables those). Added in API level 9.
"nosensor"  The orientation is determined without reference to a physical orientation sensor. The sensor is ignored, so the display will not rotate based on how the user moves the device. Except for this distinction, the system chooses the orientation using the same policy as for the "unspecified" setting.

// AndroidManifest.xml
<activity android:name="OrientationActivity"
                   android:screenOrientation="portrait" >
</activity>

沒有留言:

張貼留言