我试图强制我的应用程序使用"纵向"模式,因为我的应用程序绝对不是为"横向"模式设计的.
在阅读了一些论坛之后,我在 list 文件中添加了以下几行:
<application
android:debuggable="true"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:screenOrientation="portrait">
但它在我的设备(HTC Desire)上不起作用.它从"纵向"切换到"横向",忽略 list 文件中的行.
在阅读了更多论坛后,我试图将其添加到我的 list 文件中:
<application
android:debuggable="true"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:configChanges="orientation"
android:screenOrientation="portrait">
在我的活动课上有一个函数:
public void onConfigurationChanged(Configuration newConfig)
{
super.onConfigurationChanged(newConfig);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
但同样,没有运气.