版权声明:本文为博主原创文章,未经博主允许不得转载。
方法其实so easy:
- popupWindow.setTouchable(true);
- popupWindow.setFocusable(true);
- popupWindow.setBackgroundDrawable(new BitmapDrawable());
- popupWindow.setOutsideTouchable(true);
不行还可以加上:
- popupWindow.setTouchInterceptor(new OnTouchListener() {
- public boolean onTouch(View v, MotionEvent event) {
- if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {
- popupWindow.dismiss();
- return true;
- }
- return false;
- }
- });