Android全面屏手机判断NavigationBar是否可见

if(root_view_height < DisplayUtils.getScreenHeight(VideoPlayerActivity.this)){
                        layoutParams.bottomMargin = mainInvisibleHeight- BarUtils.getNavBarHeight();
                    }else {
                        layoutParams.bottomMargin = mainInvisibleHeight;
                    }

root_view_height 为根布局的高度
DisplayUtils.getScreenHeight(VideoPlayerActivity.this) 屏幕的高度

root_view.post(new Runnable() {
            @Override
            public void run() {
                root_view_height = root_view.getHeight();
            }
        });

你可能感兴趣的:(Android全面屏手机判断NavigationBar是否可见)