android

Only fullscreen opaque activitie

2020-07-21  本文已影响0人  WLHere

在android8.0/8.1(api26/27)的设备,如果targetSdkVersion > 26则会出现此问题
出问题的位置如下

protected void onCreate(@Nullable Bundle savedInstanceState) {
        if (DEBUG_LIFECYCLE) Slog.v(TAG, "onCreate " + this + ": " + savedInstanceState);

        if (getApplicationInfo().targetSdkVersion > O && 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");
            }
        }

        // other codes
    }

修复方法:
判断设备是android8.0/8.1(api26/27)则不设置方向或者设置不透明的主题

上一篇 下一篇

猜你喜欢

热点阅读