Search code examples
androidonclickontouchlistenerandroid-popupwindowontouch

How disable triggering onClick after onTouch


How disable instant triggering onClik button afrer onTouch MotionEvent.ACTION_OUTSIDE. I have a popupwindow, when I click on the outside and on the background I have a button, edittext or checkbox, then the button is triggered, if this is edittext, then the focus moves to it, if checkbox then it becomes checked. How disable click after onTouch?
added video example https://youtu.be/yyT47y-CL-o


Solution

  • Try this:

    popupWindow.setBackgroundDrawable(new StateListDrawable())
    popupWindow.setOutsideTouchable(true);
    popupWindow.setFocusable(true);