標籤:use specified blank article 應用 ecif user color activity
通常我們的應用只會設計成橫屏或者豎屏,鎖定橫屏或豎屏的方法是在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橫豎屏重力自適應