问题
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