public static void immersiveStatusBar(Window window, @FloatRange(from = 0.0d, to = 1.0d)
float alpha) {
if (VERSION.SDK_INT >= 19) {
if (VERSION.SDK_INT >= 21) {
window.clearFlags(67108864);
window.addFlags(Integer.MIN_VALUE);
window.setStatusBarColor(0);
window.getDecorView().setSystemUiVisibility((window.getDecorView()
.getSystemUiVisibility() | 1024) | 256);
} else {
window.addFlags(67108864);
}
ViewGroup decorView = (ViewGroup) window.getDecorView();
View rootView = ((ViewGroup) window.getDecorView().findViewById(16908290)).getChildAt
(0);
int statusBarHeight = getStatusBarHeight(window.getContext());
if (rootView != null) {
LayoutParams lp = (LayoutParams) rootView.getLayoutParams();
ViewCompat.setFitsSystemWindows(rootView, true);
lp.topMargin = -statusBarHeight;
rootView.setLayoutParams(lp);
}
setTranslucentView(decorView, alpha);
}
}
SystemBarHelper.java 文件源码
java
阅读 45
收藏 0
点赞 0
评论 0
项目:boohee_v5.6
作者:
评论列表
文章目录