How to detect full screen gesture mode in android Q

℡╲_俬逩灬. 提交于 2019-12-31 10:43:13

问题


In Android Q, users can enable full screen gesture mode. I want to detect whether the device in full screen gesture mode or not. I can't find anything in documentation. How to do it programmatically at run time?

Java or kotlin language answer is OK.

Any official API or workaround...


回答1:


According to docs, you can get area of gesture space using getSystemGestureInsets(): https://developer.android.com/reference/android/view/WindowInsets.html#getSystemGestureInsets()

If it's zero, then it's disabled

    ViewCompat.setOnApplyWindowInsetsListener(view, (v, insets) -> {
        if (insets.getSystemGestureInsets().bottom == 0 
            && insets.getSystemGestureInsets().left == 0
            && insets.getSystemGestureInsets().right == 0) 
        {
            //gestures enabled
        }
        return insets.consumeSystemWindowInsets();
    });

However, I don't have device with Android Q, and I might be wrong

I've found it in this article: https://developer.android.com/preview/features/gesturalnav



来源:https://stackoverflow.com/questions/56689210/how-to-detect-full-screen-gesture-mode-in-android-q

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