dismiss the popup window by back button

前端 未结 6 1281
感情败类
感情败类 2020-12-17 17:38

I want to Dismiss the popup window by clicking outside of the popup window or by the back button, but when click on the back button my application exit\'s, instead of exitin

6条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-17 18:26

    Try this way: Implement onBackPressed() and add

    if(popup!=null) {
        popup.dismiss();
        popup=null;
    }
    

    And set your PopWindow with below:

    popup.setOutsideTouchable(true);
    

提交回复
热议问题