我有一个有四个活动的应用程序,其中一个应该固定为景观模式。如果我正在查看横向活动,请锁定我的手机并再次解锁,该活动在纵向模式下显示一小段时间,然后转到横向模式。如何防止手机解锁后出现画像模式的短暂瞬间?
这是我指定屏幕方向的清单:
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".add" />
<activity android:name=".kats" />
<activity
android:name=".game"
android:screenOrientation="landscape"
android:configChanges="keyboardHidden|orientation"/>
</application>发布于 2017-08-12 07:54:45
添加2个元素,首先在你的清单中:
<activity android:name="Activity"
android:screenOrientation="landscape"
android:configChanges="keyboardHidden|orientation|screenSize">
...
</activity>在您的活动中:
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);https://stackoverflow.com/questions/45643392
复制相似问题