不要在外部点击时关闭弹出窗口

Don't Dismiss Popup On Outside Click

我有一个弹出窗口 window,我想以编程方式膨胀和关闭它,我不希望任何用户输入将其关闭。然而,当在弹出窗口之外触摸屏幕时,弹出窗口被关闭,我知道这个问题之前已经被问过,但我已经尝试了我发现的每一个变体,但我似乎无法完成这项工作......这是我的代码:

LayoutInflater inflater = (LayoutInflater)
                mContext.getSystemService(LAYOUT_INFLATER_SERVICE);
        View popupView = inflater.inflate(R.layout.custom_loading, null);
        int width = LinearLayout.LayoutParams.WRAP_CONTENT;
        int height = LinearLayout.LayoutParams.WRAP_CONTENT;
        boolean focusable = false;
        popupWindow = new PopupWindow(popupView, width, height, focusable);
        popupWindow.setElevation(20);
        popupWindow.setBackgroundDrawable(ContextCompat.getDrawable(mContext, R.drawable.transparent_back));
        popupWindow.setTouchable(true);
        popupWindow.setOutsideTouchable(true);
        popupWindow.setTouchInterceptor((View view, MotionEvent motionEvent) -> {return false;});
        popupWindow.showAtLocation(v, Gravity.CENTER, 0, 0);// v is a view passed as a parameter to the function

提前致谢! :)

已修复!新代码:

 boolean focusable = false;
 popupWindow.setBackgroundDrawable(null);

以下已删除:

popupWindow.setTouchable(true);
popupWindow.setOutsideTouchable(true);
popupWindow.setTouchInterceptor((View view, MotionEvent motionEvent) -> {return false;});