美文网首页
App全屏进入非全屏闪动的问题

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

作者: 苏鑫最胖的一组 | 来源:发表于2017-04-01 11:35 被阅读0次

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全屏进入非全屏闪动的问题

      本文链接:https://www.haomeiwen.com/subject/raliottx.html