美文网首页
PopupWindow显示位置问题

PopupWindow显示位置问题

作者: Batashi | 来源:发表于2018-08-23 19:28 被阅读0次
    /**
         * 适配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显示位置问题

          本文链接:https://www.haomeiwen.com/subject/nugmiftx.html