1. 有两种设置屏幕方向的方式:
1)在AndroidManifest.xml 中配置activity时增加 android:orientation属性即可,如:
<activity android:name=".TestActivity" android:screenOrientation="xxx">
xxx代表的值可选项如下:
Constant | Value | Description |
---|---|---|
unspecified |
-1 | No preference specified: let the system decide the best orientation. This will either be the orientation selected by the activity below, or the user's preferred orientation if this activity is the bottom of a task. If the user explicitly turned off sensor based orientation through settings sensor based device rotation will be ignored. If not by default sensor based orientation will be taken into account and the orientation will changed based on how the user rotates the device |
landscape |
0 | Would like to have the screen in a landscape orientation: that is, with the display wider than it is tall, ignoring sensor data. |