I use the following code to show a popup menu when the user taps an
anchor button.

    final ListPopupWindow popup = new ListPopupWindow(this);

    anchorButtonView.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View view) {
        if (!popup.isShowing()) {  // This check is not helping
          popup.show();
        }
      }
    });

What I would like is that if the user touches the anchor button, the
popup gets dismissed. Currently, the popup gets dismissed but is
immediately displayed again. I tried using !popup.isShowing() as shown
above, but that does not help as the popup is dismissed by the time
#onClick is getting called. I also tried using
achorButtonView.setOnTouchListener, but the popup is already dismissed
when that method is called also.

I can use ListPopupWindow#setModal(true) and get the popup to be
dismissed. However, now, none of the touches to widgets outside of the
popup get dispatched. They only dismiss the popup. You then have to
the widget again.

What I want is that touches to widgets other than the anchor get
dispatched to those widgets, but touches to the anchor do not result
in re-displaying the popup. Is there any way to achieve this?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to