Android 获取状态栏高度

Android About 312 words

代码

在状态栏不存在的时候会获得其高度为0

public static int getStatusBarHeight() {
    int result = 0;
    int resourceId = Resources.getSystem().getIdentifier("status_bar_height", "dimen", "android");
    if (resourceId > 0) {
        result =Resources.getSystem().getDimensionPixelSize(resourceId);
    }
    return result;
}
Views: 3,701 · Posted: 2019-04-14

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb/LiteNote

扫描下方二维码关注公众号和小程序↓↓↓

扫描下方二维码关注公众号和小程序↓↓↓


Today On History
Browsing Refresh