popupwindow设置点击外部不消失

mPopupWindow= new PopupWindow(view, ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT,true);
mPopupWindow.setFocusable(true);
mPopupWindow.setOutsideTouchable(true);
mPopupWindow.setTouchInterceptor(new View.OnTouchListener() {
    @Override
    public boolean onTouch(View v, MotionEvent event) {
        return true;
    }
});
mPopupWindow.setBackgroundDrawable(null);

猜你喜欢

转载自blog.csdn.net/xiexiaotian11/article/details/90756491