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

StatusBarUtil.setLightMode(this) => Toolbar goes behind statusBar #284

Open
Morteza-Rastgoo opened this issue Dec 11, 2019 · 1 comment
Open

Comments

@Morteza-Rastgoo
Copy link

Screen Shot 2019-12-11 at 4 19 47 PM

@vodLee
Copy link

vodLee commented Dec 25, 2019

I find this question too. The question is this util change your theme in this two func. You could change this func in util like this.
`
@TargetApi(Build.VERSION_CODES.M)
public static void setLightMode(Activity activity) {
setMIUIStatusBarDarkIcon(activity, true);
setMeizuStatusBarDarkIcon(activity, true);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
int visibility = activity.getWindow().getDecorView().getSystemUiVisibility();
if (visibility != (visibility | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR)) {
visibility = visibility | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
}
activity.getWindow().getDecorView().setSystemUiVisibility(visibility);
}
}

@TargetApi(Build.VERSION_CODES.M)
public static void setDarkMode(Activity activity) {
    setMIUIStatusBarDarkIcon(activity, false);
    setMeizuStatusBarDarkIcon(activity, false);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        int visibility = activity.getWindow().getDecorView().getSystemUiVisibility();
        if (visibility == (visibility | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR)) {
            visibility = visibility ^ View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
        }
        activity.getWindow().getDecorView().setSystemUiVisibility(visibility);
    }
}`

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

No branches or pull requests

2 participants