标签:cte attribute led row false save util cep base
java java.lang.IllegalStateException: Only fullscreen opaque activities can request orientation
protected void onCreate(@Nullable Bundle savedInstanceState) {
if (DEBUG_LIFECYCLE) Slog.v(TAG, "onCreate " + this + ": " + savedInstanceState);
if (getApplicationInfo().targetSdkVersion >= O_MR1 && mActivityInfo.isFixedOrientation()) {
final TypedArray ta = obtainStyledAttributes(com.android.internal.R.styleable.Window);
final boolean isTranslucentOrFloating = ActivityInfo.isTranslucentOrFloating(ta);
ta.recycle();
if (isTranslucentOrFloating) {
throw new IllegalStateException(
"Only fullscreen opaque activities can request orientation");
}
}
......
}
void setRequestedOrientation(int requestedOrientation) {
if (ActivityInfo.isFixedOrientation(requestedOrientation) && !fullscreen
&& appInfo.targetSdkVersion >= O_MR1) {
throw new IllegalStateException("Only fullscreen activities can request orientation");
}
......
}
@Override
protected void onCreate(Bundle savedInstanceState) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && UiUtils.isTranslucentOrFloating(this)) {
UiUtils.fixOrientation(this);
KLog.debug("api 26 全屏横竖屏切换 crash");
}
super.onCreate(savedInstanceState);
......
}
@Override
public void setRequestedOrientation(int requestedOrientation) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && UiUtils.isTranslucentOrFloating(this)) {
KLog.debug("api 26 全屏横竖屏切换 crash");
return;
}
super.setRequestedOrientation(requestedOrientation);
}
Android Api 27 在 Android 8.0 上出现 Only fullscreen opaque activities can request orientation 的解决情况
标签:cte attribute led row false save util cep base
原文地址:https://www.cnblogs.com/liyiran/p/10362881.html