1、配置主题
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowIsTranslucent">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>必须
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:windowBackground">@color/c_F6F6F6</item>
</style>
2、设置图标的主题颜色
public static void setStatusBarIconTheme(Activity activity, boolean isLight) {
View decorView = activity.getWindow().getDecorView();
int ui = 0;
if (isLight) {
ui = View.SYSTEM_UI_FLAG_VISIBLE;
} else {
ui = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
}
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | ui);
}
isLight = false:黑色
isLight = true:白色