实现Android沉浸式状态栏很简单,加一个android:fitsSystemWindows="true",public static void setSystemBar(Activity activity, int color) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
setTranslucentStatus(activity, true);
SystemBarTintManager tintManager = new SystemBarTintManager(activity);
tintManager.setStatusBarTintEnabled(true);
// 使用颜色资源
tintManager.setStatusBarTintResource(color);
}