问题描述
我在AndroidManifest.xml中将screenorientation设置为横向。这对于Android Studio中大多数模拟的设备都可以正常工作。
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true">
<activity
android:name=".FullscreenActivity"
android:screenorientation="landscape"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/app_name"
android:theme="@style/FullscreenTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
和在OnCreate
中requestwindowFeature(Window.FEATURE_NO_TITLE);
getwindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_fullscreen);
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
FullscreenActivity.context = getApplicationContext();
getSupportActionBar().hide();
但是对于Nexus 9而言,该功能无法正常工作,我的应用仍处于纵向模式,这会使我的图像失真。
我希望会是这样:
两者的启动方向均为纵向。我想拥有一个仅适用于景观的应用程序