zoukankan      html  css  js  c++  java
  • 通过反射获取Android通知栏高度

    public static int getStatusBarHeight(Context context){
            Class<?> c = null;
            Object obj = null;
            Field field = null;
            int x = 0, statusBarHeight = 0;
            try {
                c = Class.forName("com.android.internal.R$dimen");
                obj = c.newInstance();
                field = c.getField("status_bar_height");
                x = Integer.parseInt(field.get(obj).toString());
                statusBarHeight = context.getResources().getDimensionPixelSize(x);
            } catch (Exception e1) {
                e1.printStackTrace();
            } 
            return statusBarHeight;
        }
  • 相关阅读:
    7-11
    7-9
    7-8
    7-7
    7-6
    7-5
    7-4
    7-3
    第08次:升级《陋习手记》完善主从UI
    第07次:升级《陋习手记》显示多条数据
  • 原文地址:https://www.cnblogs.com/taoweiji/p/4331135.html
Copyright © 2011-2022 走看看