Detecting when the system ui is visible with sticky immersive mode

回眸只為那壹抹淺笑 提交于 2021-02-18 22:59:48

问题


When using sticky immersive mode (https://developer.android.com/training/system-ui/immersive.html) neither the View.OnSystemUiVisibilityChangeListener is called nor will any visibility flags be cleared (like View.SYSTEM_UI_FLAG_HIDE_NAVIGATION):

Sticky flag—This is the UI you see if you use the IMMERSIVE_STICKY flag, and the user swipes to display the system bars. Semi-transparent bars temporarily appear and then hide again. The act of swiping doesn't clear any flags, nor does it trigger your system UI visibility change listeners, because the transient appearance of the system bars isn't considered a UI visibility change.

I have a view with complex gesture detection code. The down swipe to show the system navigation ui does interfere with these gestures. If I use the regular immersive mode I can check for the system navigation ui to be visible in which case I ignore the gestures but with the sticky mode that check is not possible (as explained above).

Does anyone know how to determine if the system navigation ui is visible in sticky immersive mode or does anyone have another idea how to deal with the down swipe that interferes with my own gesture detection code?

I'm aware of this question Detecting when system buttons are visible while using 'immersive mode' but I've seen apps that use sticky immersive mode with gesture detection that don't get messed up by the down swipe.

来源:https://stackoverflow.com/questions/26045462/detecting-when-the-system-ui-is-visible-with-sticky-immersive-mode

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!