Android 获取系统顶部状态栏高度和底部导航栏的高度

来源:互联网 发布:树莓派网络配置 编辑:程序博客网 时间:2024/05/16 12:01

本文转载:
http://www.cnblogs.com/rossoneri/p/4142962.html
获取顶部status bar 高度

private int getStatusBarHeight() {    Resources resources = mActivity.getResources();    int resourceId = resources.getIdentifier("status_bar_height", "dimen","android");    int height = resources.getDimensionPixelSize(resourceId);    Log.v("dbw", "Status height:" + height);    return height;}

获取底部 navigation bar 高度

private int getStatusBarHeight() {    Resources resources = mActivity.getResources();    int resourceId = resources.getIdentifier("status_bar_height", "dimen","android");    int height = resources.getDimensionPixelSize(resourceId);    Log.v("dbw", "Status height:" + height);    return height;}
0 0
原创粉丝点击