shoneworn
    /**
     * 获取状?栏高?
     *
     * @param context
     * @return
     */
    public static int getStatusHeight(Context context) {
        int statusHeight = 0;
        Class<?> localClass;
        try {
            localClass = Class.forName("com.android.internal.R$dimen");
            Object localObject = localClass.newInstance();
            int i5 = Integer.parseInt(localClass.getField("status_bar_height").get(localObject)
                    .toString());
            statusHeight = context.getResources().getDimensionPixelSize(i5);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (NumberFormatException e) {
            e.printStackTrace();
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
        } catch (SecurityException e) {
            e.printStackTrace();
        } catch (NoSuchFieldException e) {
            e.printStackTrace();
        }

        return statusHeight;
    }

 

分类:

技术点:

相关文章:

  • 2021-12-28
  • 2021-12-18
  • 2021-10-29
  • 2021-11-03
  • 2021-10-16
  • 2021-12-18
  • 2021-11-20
  • 2021-12-28
猜你喜欢
  • 2021-11-14
  • 2021-06-18
  • 2021-04-08
  • 2021-11-02
  • 2021-07-01
  • 2021-05-29
  • 2021-10-06
相关资源
相似解决方案