状态栏与底部导航栏


/*获取状态栏的高度,有时候出现popuwindow超出屏幕时,减去它,默认24dp*/

//获取顶部状态栏的高度
 private int getStatusBarHeight() {
    Resources resources = MainActivity.this.getResources();
    int resourceId = resources.getIdentifier("status_bar_height", "dimen","android");
    int height = resources.getDimensionPixelSize(resourceId);
    Log.v("dbw", "Status height:" + height);
    return height;
}

 //获取底部 navigationbar的高度
private int getNavigationBarHeight() {
    Resources resources = MainActivity.this.getResources();
    int resourceId = resources.getIdentifier("navigation_bar_height","dimen", "android");
    int height = resources.getDimensionPixelSize(resourceId);
    Log.v("dbw", "Navi height:" + height);
    return height;
}



原创文章 19 获赞 4 访问量 2万+

猜你喜欢

转载自blog.csdn.net/whyareusomw/article/details/65445645
今日推荐