Avoiding PopupWindow dismissal after touching outside

后端 未结 8 1951
灰色年华
灰色年华 2020-12-31 05:07

I would like to use a PopupWindow with following behaviours/features:

  • It is focusable (has interactive controls inside eg. buttons)
  • The View \'under\'
相关标签:
8条回答
  • 2020-12-31 06:05

    it's too late but for people who google this stuff just change the order of lines

    pw.showAtLocation(frameLayout, Gravity.BOTTOM, 0, 0);
    pw.setOutsideTouchable(true);
    pw.setTouchable(true);
    pw.setBackgroundDrawable(new BitmapDrawable());
    pw.setTouchInterceptor(customPopUpTouchListenr);
    

    instead of

    pw.setOutsideTouchable(true);
    pw.setTouchable(true);
    pw.setBackgroundDrawable(new BitmapDrawable());
    pw.setTouchInterceptor(customPopUpTouchListenr);
    pw.showAtLocation(frameLayout, Gravity.BOTTOM, 0, 0);
    

    putting anything after showatlocation method makes it like nothing there

    0 讨论(0)
  • 2020-12-31 06:05

    pw.setOutsideTouchable(false);

    0 讨论(0)
提交回复
热议问题