這個android:screenOrientation我很少用到. 模模糊糊又沒啥概念,今天看了一個項目用到了. 百度下記錄下吧 .
在配置文件中的使用方法如下:
<activity android:name=".AppStart" android:label="@string/app_name" android:screenOrientation="portrait"//設置 該頁面 只能 豎直屏幕方向顯示 android:theme="@style/Theme.AppStartLoad"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>
還有其他幾個值,但是如果用翻譯軟件去翻譯的話.絕對把你搞蒙了.
android:screenOrientation="" 這句話默認不寫的話,其實就是android:screenOrientation="unspecified"
這是一個默認值,有系統選擇顯示方向,在不同的設備上可能結果不太一樣.
android:screenOrientation="landscape" 橫向屏幕
android:screenOrientation="portrait" 豎向屏幕
android:screenOrientation="user" 用戶當前首選方向
android:screenOrientation="behind" 與在活動/Activity堆棧下的Activity方向相同
android:screenOrientation="sensor" 根據物理方向傳感器 來確定方向,比如有的游戲既支持豎屏也支持橫屏,取決於用戶手持方向.
android:screenOrientation="nosensor" 不隨 物理方向傳感器確定方向,該傳感器唄忽略,所以當用戶轉動設備,顯示不會跟隨改變,除了這個區別. 這個怎么理解呢? 其實可以理解成系統關閉重力感應.