我有一个从浏览器打开的活动
当设备处于横向状态时,请将我误解为错误
当设备处于横向状态时,请将我误解为错误
java.lang.IllegalStateException: Only fullscreen opaque activities can request orientation
表现
<activity android:name=".Activity.MyActivity"
android:configChanges="orientation"
android:screenorientation="portrait"
android:theme="@style/AppTheme.Theme_Slide"
>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.broWSABLE" />
<data
android:host="xxx"
android:scheme="xxx" />
<data
android:host="xxx"
android:scheme="xxx" />
</intent-filter>
</activity>
style.xml
<style name="AppTheme.Theme_Slide" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowCloSEOnTouchOutside">false</item>
</style>
解决方法
UPDATE
寻找解决方案
寻找解决方案
在android Oreo中,你不能改变Activity的方向
<item name="android:windowIsTranslucent">true</item>
在风格.您必须先从清单中删除以下行
android:screenorientation="portrait"
其次,您必须将此行添加到java文件中
//android O fix bug orientation
if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}