Android全面屏手機判斷NavigationBar是否可見
阿新 • • 發佈:2018-12-09
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();
}
});