美文网首页
状态栏相关

状态栏相关

作者: chandarlee | 来源:发表于2016-10-28 13:48 被阅读6次
    public static int getStatusBarHeight(Context context) {
            if (statusbarheight == 0) {
                try {
                    Class<?> c = Class.forName("com.android.internal.R$dimen");
                    Object o = c.newInstance();
                    Field field = c.getField("status_bar_height");
                    int x = (Integer) field.get(o);
                    statusbarheight = context.getResources().getDimensionPixelSize(x);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            return statusbarheight;
        }
    

    相关文章

      网友评论

          本文标题:状态栏相关

          本文链接:https://www.haomeiwen.com/subject/xzceuttx.html