android popupwindow相关备忘录

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);

猜你喜欢

转载自blog.csdn.net/zxb3121999/article/details/50318675
今日推荐