public static int getStatusBarHeight(Context context)
    {
        int result = 0;
        try
        {
            int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android");
            if (resourceId > 0)
            {
                result = context.getResources().getDimensionPixelSize(resourceId);
            }
        } catch (Resources.NotFoundException e)
        {
            e.printStackTrace();
        }
        return result;
    }
Created by zhy on 15/12/4.<br/>
form http://stackoverflow.com/questions/1016896/get-screen-dimensions-in-pixels/15699681#15699681
autolayout/src/main/java/com/zhy/autolayout/utils/ScreenUtils.java