【轉】Android橫豎屏重力自適應
阿新 • • 發佈:2018-01-24
ron ati lan target 設計 根據 use rpo 適應
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
"reverseLandscape" | "reversePortrait" |
"sensorLandscape" | "sensorPortrait" |
"userLandscape" | "userPortrait" |
"sensor" | "fullSensor" | "nosensor" |
"user" | "fullUser" | "locked"]
通常我們的應用只會設計成橫屏或者豎屏,鎖定橫屏或豎屏的方法是在manifest.xml文件中設定屬性android:screenOrientation為"landscape"或"portrait":
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
其實screenOrientation還可以設置成很多值:
android:screenOrientation = ["unspecified" | "behind" |
"landscape" | "portrait" |
"reverseLandscape" | "reversePortrait" |
"sensorLandscape" | "sensorPortrait" |
"userLandscape" | "userPortrait" |
"sensor" | "fullSensor" | "nosensor" |
"user" | "fullUser" | "locked"]
其中sensorLandscape就是橫屏根據重力上下翻轉,sensorPortrait豎屏根據重力上下翻轉。
如果有興趣,你也可以試試其他的值哦...
轉自:http://blog.csdn.net/oracleot/article/details/19045011
【轉】Android橫豎屏重力自適應