setRootViewFitsSystemWindows(false);
getSystemBarTintManager().setStatusBarTintEnabled(false);
// 设置状态栏填充物高度
View statusBarTintView = findViewById(R.id.statusBarTintView);
ViewGroup.LayoutParams params = statusBarTintView.getLayoutParams();
params.height = getSystemBarTintManager().isStatusBarAvailable() ? getStatusBarHeight(this) : 0;
statusBarTintView.setLayoutParams(params);
getSystemBarTintManager().setStatusBarTintEnabled(false);
// 设置状态栏填充物高度
View statusBarTintView = findViewById(R.id.statusBarTintView);
ViewGroup.LayoutParams params = statusBarTintView.getLayoutParams();
params.height = getSystemBarTintManager().isStatusBarAvailable() ? getStatusBarHeight(this) : 0;
statusBarTintView.setLayoutParams(params);
本文介绍了如何在Android应用中通过编程方式自定义状态栏的显示效果,包括取消沉浸式效果、禁用状态栏着色并调整其高度。
3万+

被折叠的 条评论
为什么被折叠?



