I got solution. In 80% layout, creating layout.setontouchlistener and in action_down i'm dismissing the popup window. ref_pup.dismiss();
popup dismiss on touch outside of popup
-
10-06-2023 - |
Pergunta
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);
}
});
Solução 3
Outras dicas
You have used : pup1.setOutsideTouchable(true);
Set this property to "false".
Replace this
pup1.setOutsideTouchable(true);
with this:
pup1.setOutsideTouchable(false);
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow