我7.0的手机,目标view在屏幕偏上方,PopupWindow却全屏显示了,PopupWindow的宽高都是match_parent。
试的第一个方法如下:
if (Build.VERSION.SDK_INT < 24) { popuwindow.showAsDropDown(v); } else { int[] location = new int[2]; v.getLocationOnScreen(location); int x = location[0]; int y = location[1]; popuwindow.showAtLocation(v, Gravity.