App全屏进入非全屏闪动的问题的解决

privatevoidsmoothSwitchScreen() {// 5.0以上修复了此bugif(Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {

ViewGroup rootView = ((ViewGroup)this.findViewById(android.R.id.content));

intresourceId = getResources().getIdentifier("status_bar_height","dimen","android");intstatusBarHeight = getResources().getDimensionPixelSize(resourceId);

rootView.setPadding(0, statusBarHeight,0,0);

getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);

getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);

}

}

直接在setcontentview之前调用,代码比较简单就是获取状态栏的高度设置为Padding,这里就不解释了

你可能感兴趣的:(App全屏进入非全屏闪动的问题的解决)