zoukankan      html  css  js  c++  java
  • 获得状态栏的高度

       public static int getStatusHeight(Activity activity){
            int statusHeight = 0;
            Rect localRect = new Rect();
            activity.getWindow().getDecorView(
            ).getWindowVisibleDisplayFrame(localRect); statusHeight
    = localRect.top; if (0 == statusHeight){ 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
    = activity.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; }
  • 相关阅读:
    Magento:Paypal付款不成功返回后不要清空购物车产品的解决方案
    magento设置订单状态
    linux下查看所有用户以及用户组
    网站无法访问的原因
    magento 多域名多店铺
    linode空间lamp环境的搭建
    hp p410固件更新
    tracert
    镜像架设
    nohup
  • 原文地址:https://www.cnblogs.com/jason-star/p/3272774.html
Copyright © 2011-2022 走看看