我想在AndroidManifest中鎖定指定配置的屏幕方向,而不是以編程方式進行。所以,我結束了以下方法:嘗試將方向屏幕修復爲自然或默認方向時出現問題
值/ config.xml中
<resources>
<integer name="orientation">1</integer>
</resources>
價值觀sw600dp/config.xml中
<resources>
<integer name="orientation">0</integer>
</resources>
如果我檢查值的資源編程
getResources().getInteger(R.integer.orientation)
我得到期望值:平板電腦爲0,手機爲1,分別爲橫向和縱向框架指定的值。
但是,如果使用在AndroidManifest此資源:
<activity
android:name="activities.InitialConfigActivity_"
android:noHistory="true"
android:screenOrientation="@integer/orientation" />
活動啓動總是在縱向模式下,如果不管它是一個平板電腦或手機設備。
有什麼想法?
謝謝!