使用了autosize做屏幕适配,使用StatusBarUtil做沉浸式;发现使用了StatusBarUtil的界面的状态栏高度不对;
//auto size
implementation 'me.jessyan:autosize:1.1.2'
修改StatusBarUtil的getStatusBarHeight方法,使用AutoSize的ScreenUtils获取状态栏高度即可:
/**
* 获取状态栏高度
*
* @param context context
* @return 状态栏高度
*/
private static int getStatusBarHeight(Context context) {
// 获得状态栏高度
/* int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android");
return context.getResources().getDimensionPixelSize(resourceId);*/
return ScreenUtils.getStatusBarHeight();
}