Android - ImageButton Loses Pressed State When Notification Drawer is Pulled Down

32 views Asked by At

I am losing the pressed state of my ImageButton when the notification drawer is dragged down form the top.

I'm not sure why this is happening? I'm currently using onSaveInstanceState and onRestoreInstanceState to ensure that the ImageButtons state get's saved and restored.

For the most part it does it's job, the only issue I am having is when the notification drawer get's pulled down. Does anyone know why this is causing my ImageButton to lose it's pressed state and how to get around it?

1

There are 1 answers

0
Rafiq07 On

Looks like the only way to get to detect the notification drawer is using 'onWindowFocusChanged'. This returns false when the drawer is pulled down and true when it get's pulled back up again.