Android 点击PopWindow外围,PopWindow消失

popupWindow.setOutsideTouchable(true);
ColorDrawable dw = new ColorDrawable(Color.BLACK);
popupWindow.setBackgroundDrawable(dw);
popupWindow.update();
popupWindow.setTouchInterceptor(new OnTouchListener() {

@Override
public boolean onTouch(View v, MotionEvent event) {
if (popupWindow != null && popupWindow.isShowing()) {  
           popupWindow.dismiss();  
           popupWindow = null;
           return true;
       }  
       return false; 
}
});

你可能感兴趣的:(Android 点击PopWindow外围,PopWindow消失)