ScreenShot.java 文件源码

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

项目:weex-3d-map 作者:
public static  int getStatusBarHeight(Activity activity) {
    int result = 0;
    Rect rect = new Rect();
    Window window = activity.getWindow();
    if (window != null) {
        window.getDecorView().getWindowVisibleDisplayFrame(rect);
        View v = window.findViewById(Window.ID_ANDROID_CONTENT);

        android.view.Display display = ((android.view.WindowManager) activity.getSystemService(activity.WINDOW_SERVICE)).getDefaultDisplay();

        //return result title bar height
        int result1 = display.getHeight() - v.getBottom() + rect.top;
        int result2  = display.getHeight() - v.getBottom();
        int result3 = v.getTop() - rect.top;
        int result4 = display.getHeight() - v.getHeight();

        Log.e("StatusBarHeight==", "result1== " + result1 +" result2 = " + result2 + "result3=" + result3 + "result4=" +result4  ) ;
    }
    return result;

}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号