SillyAndroid.java 文件源码

java
阅读 35 收藏 0 点赞 0 评论 0

项目:silly-android 作者:
/**
 * Tries to get the status bar height for this device. Even if the value returned is larger than 0, that does not mean the status bar is visible.
 *
 * @param context A context to use to find the status bar height
 * @return Height of the status bar on the running device, in pixels
 */
@IntRange(from = 0)
public static int getStatusBarHeight(@NonNull final Context context) {
    int result = 0;
    int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android");
    if (resourceId > 0) {
        result = context.getResources().getDimensionPixelSize(resourceId);
    }
    return result;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号