1.让popupWidow在指定控件或位置上方显示:
int[] location = new int[2];
view.getLocationOnScreen(mLocation);
mPopupWindow.showAtLocation(mGradeView, Gravity.NO_GRAVITY, mLocation[0], mLocation[1]-mPopupWindow.getHeight());
2.点击popupWindow以外的区域,popupWindow消失:
mPopupWindow.setBackgroundDrawable(new BitmapDrawable());
mPopupWindow.setOutsideTouchable(true);