简体   繁体   中英

How to set an action when I click outside of the popup window?

I want to set an action or do something like change button background when click outside of the PopupWindow .

Here marked default button color:- 在此处输入图片说明

Here marked changed button color after click:- 在此处输入图片说明

After clicking outside of the PopupWindow , I want to change my button background to default.

How can i do that? I need some help.

Use an OnDismissListener for your PopupWindow :

    popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
        @Override
        public void onDismiss() {
            // Change the icon
        }
    });

Where popupWindow is the PopupWindow you are displaying.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM