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

猜你喜欢

转载自blog.csdn.net/shanghome/article/details/14229429
今日推荐