diff --git a/app/src/main/java/com/baozi/mvp/base/BaseActivity.java b/app/src/main/java/com/baozi/mvp/base/BaseActivity.java index 8bd0125..94ca7d7 100644 --- a/app/src/main/java/com/baozi/mvp/base/BaseActivity.java +++ b/app/src/main/java/com/baozi/mvp/base/BaseActivity.java @@ -106,6 +106,7 @@ protected void initStatusBar() { } int statusBarDrawable = getStatusBarDrawable(); if (statusBarView != null) { + statusBarView.setBackgroundDrawable(null); statusBarView.setBackgroundResource(statusBarDrawable); } } diff --git a/app/src/main/java/com/baozi/mvp/utils/StatusBarUtil.java b/app/src/main/java/com/baozi/mvp/utils/StatusBarUtil.java index bfaf82f..a47b80c 100644 --- a/app/src/main/java/com/baozi/mvp/utils/StatusBarUtil.java +++ b/app/src/main/java/com/baozi/mvp/utils/StatusBarUtil.java @@ -53,6 +53,9 @@ public void setStatusBar(Activity activity, int statusId = activity.getResources().getIdentifier("statusBarBackground", "id", "android"); View statusBarView = window.findViewById(statusId); if (statusBarView != null) { + if (isLight) { + statusBarView.setBackgroundDrawable(null); + } statusBarView.setBackgroundResource(statusBarDrawable); } //5.0以下不允许修改字体颜色 @@ -61,6 +64,7 @@ public void setStatusBar(Activity activity, statusBarView.setBackgroundResource(normalRes); } } + StatusBarUtil.setStatusBarLightMode(window, isLight); }