PopupWindow显示位置问题

/**
     * 适配7.0-、7.0、7.1及8.0版本手机
     * @param anchor
     * @param xoff
     * @param yoff
     */
    @Override
    public void showAsDropDown(View anchor, int xoff, int yoff)
    {
        if (Build.VERSION.SDK_INT >= 24)
        {
            Rect rect = new Rect();
            anchor.getGlobalVisibleRect(rect);
            int height = anchor.getResources().getDisplayMetrics().heightPixels - rect.bottom - 5;
            setHeight(height);
        }
        super.showAsDropDown(anchor, xoff, yoff);
    }

你可能感兴趣的:(PopupWindow显示位置问题)