Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

荣耀SCL-AL00沉浸式不行 #95

Closed
JakeWoki opened this issue Jan 24, 2017 · 8 comments
Closed

荣耀SCL-AL00沉浸式不行 #95

JakeWoki opened this issue Jan 24, 2017 · 8 comments

Comments

@JakeWoki
Copy link

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            setTranslucentStatus(activity, true);
            SystemBarTintManager tintManager = new SystemBarTintManager(activity, null);
            tintManager.setStatusBarTintEnabled(true);
            tintManager.setStatusBarTintResource(colorId);
        }

@TargetApi(Build.VERSION_CODES.KITKAT)
    public static boolean setTranslucentStatus(Activity activity, boolean on) {
        Window win = activity.getWindow();
        WindowManager.LayoutParams winParams = win.getAttributes();
        final int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
        if (on) {
            winParams.flags |= bits;
        } else {
            winParams.flags &= ~bits;
        }
        win.setAttributes(winParams);

        return on;
    }

根布局加上android:fitsSystemWindows="true"这样是可以的,不过配合侧滑的效果不是很好

@laobie
Copy link
Owner

laobie commented Jan 24, 2017

华为这种没法做单独适配的,也不会单独适配

@JakeWoki
Copy link
Author

JakeWoki commented Jan 24, 2017

按我上面的做法,目前发现是所有机型都可以的,不过如果前面那个界面是透明状态栏的话,配合侧滑效果就不是很理想。可以加一个分支。

@laobie
Copy link
Owner

laobie commented Jan 24, 2017

你这引入了额外的库= =华为这种我不做兼容的,他自己修改 Rom 没必要为他做兼容

@laobie laobie closed this as completed Jan 24, 2017
@JakeWoki
Copy link
Author

JakeWoki commented Jan 24, 2017

那个库就一个类SystemBarTint,可以复制出来

@laobie
Copy link
Owner

laobie commented Jan 24, 2017

如果测试下来真的是 所有机型 都可以的话,可以提一个 pr 过来

@JakeWoki
Copy link
Author

这个当然只是我测试到的机型啊,那来所有。。。

@laobie
Copy link
Owner

laobie commented Jan 24, 2017

image
这句话是我说的咯

@JakeWoki
Copy link
Author

意思当然是我测试到的╮(╯_╰)╭

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants