if (Build.VERSION.SDK_INT < 24)
{
dropListPopupWindow.showAsDropDown(this, 0, 5);
}
else
{
// 适配 android 7.0
int[] location = new int[2];
view.getLocationOnScreen(location);
int x = location[0];
int y = location[1];
Log.e(getClass().getSimpleName(), "x : " + x + ", y : " + y);
dropListPopupWindow.showAtLocation(view, Gravity.NO_GRAVITY, 0, y + view.getHeight() + 5);
}
转载于:https://my.oschina.net/zdglf/blog/1068693