Android: Close dialog window on touch

前端 未结 5 1614
时光取名叫无心
时光取名叫无心 2020-12-15 09:25

I\'d like to close a dialog window in my android app by simply touching the screen.. is this possible? If so, how?

I\'ve looked into setting some \"onClickEven\" on

5条回答
  •  囚心锁ツ
    2020-12-15 09:39

    You can extend Dialog class and override dispatchTouchEvent() method.

    EDIT: Also you can implement Window.Callback interface and set it as dialog's window callback using dialog.getWindow().setCallback(). This implementation should call corresponding dialog's methods or handle events in its own way.

提交回复
热议问题