stewforani
2019-05-28 17:06:38 +08:00
想问下,有没有比这个更好的方案?加库暂不考虑
public static int StatusBarLightMode(Activity activity) {
int result;
if (MIUISetStatusBarLightMode(activity, true)) {
//小米
result = 1;
} else if (FlymeSetStatusBarLightMode(activity.getWindow(), true)) {
//魅族
result = 2;
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
//6.0 以上
activity.getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
result = 3;
} else {
setStatusBarColor(activity, R.color.dark_level_6);
result = 4;
}
return result;
}