0

I have two layouts one layout 80% of screen and other 20% of screen(lanscape mode), on 20% of screen layout i have few buttons vertically.on click of each button popup window will come on 80% screen layout,on touch outside popup window, popup window will get dismiss. my problem is on touch 80%screen the popup should dismiss not on 20% screen.

Ref_channel.setOnClickListener(new OnClickListener() {
        @SuppressWarnings("deprecation")
        public void onClick(View v) {               

                Display display = getWindowManager().getDefaultDisplay();
                Point size = new Point();
                display.getSize(size);
                width_device = size.x;
                X = (width_device - Ref_channel.getWidth());

                layoutInflater = (LayoutInflater) getBaseContext()
                        .getSystemService(LAYOUT_INFLATER_SERVICE);

                popupView = layoutInflater.inflate(R.layout.refchannel_popup,
                        null);
                popupView.measure(
                        MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED),
                        MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
                int s = X - (int) ((popupView.getMeasuredWidth()));

                pup1 = new PopupWindow(popupView,
                        android.view.ViewGroup.LayoutParams.WRAP_CONTENT,
                        android.view.ViewGroup.LayoutParams.WRAP_CONTENT);

                pup1.setBackgroundDrawable(new BitmapDrawable());                   
                pup1.setFocusable(true);                    
                pup1.showAtLocation(Ref_channel, 0, s, 0);

        }


    });
sachin
  • 23
  • 1
  • 6

3 Answers3

0

You have used : pup1.setOutsideTouchable(true);

Set this property to "false".

Siddharth_Vyas
  • 9,972
  • 10
  • 39
  • 69
0

Replace this

pup1.setOutsideTouchable(true);

with this:

pup1.setOutsideTouchable(false);
Shailendra Madda
  • 20,649
  • 15
  • 100
  • 138
0

I got solution. In 80% layout, creating layout.setontouchlistener and in action_down i'm dismissing the popup window. ref_pup.dismiss();

sachin
  • 23
  • 1
  • 6