Avoiding PopupWindow dismissal after touching outside
<p>I would like to use a PopupWindow with following behaviours/features:</p>

<ul>
<li>It is focusable (has interactive controls inside eg. buttons)</li>
<li>The View 'under' popupwindow has to consume the touches outside the popup properly</li>
<li>.. but the popupwindow has to stay on screen even after clicking outside</li>
</ul>

<p>I've found bunch of posts regarding PopupWindow but none of them asked question how to deal with such situation..</p>

<p>I think I tried every possible combination of setOutsideTouchable(), setFocusable(),setTouchable() but I'm stuck. Popup deals with clicks on it properly, but it's dismissed always when touching outside.</p>

<p>My current code is : 
</p>

<pre><code>View.OnTouchListener customPopUpTouchListenr = new View.OnTouchListener()
{

            @Override
            public boolean onTouch(View arg0, MotionEvent arg1) {
            Log.d("POPUP", "Touch false");
                return false;

            }
        };


        LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        LinearLayout layout= (LinearLayout)inflater.inflate(R.layout.insert_point_dialog, null);
        PopupWindow pw = new PopupWindow(layout,400,200,true);
        pw.setOutsideTouchable(true);
        pw.setTouchable(true);
        pw.setBackgroundDrawable(new BitmapDrawable());
        pw.setTouchInterceptor(customPopUpTouchListenr);
        pw.showAtLocation(frameLayout, Gravity.BOTTOM, 0, 0);
</code></pre>

<p>My general goal is to create a floating window which behaves like a 'tools palette' in software like gimp: has some controls inside, stays on top until closed by 'X' button, and allowing to interact with controls outside-under it..
Maybe there's some better way to do this, not a PopupWindow? But I still haven't found more suitable control.</p>
