如何在Android 10中检测全屏手势模式 [英] How to detect full screen gesture mode in android 10

查看:713
本文介绍了如何在Android 10中检测全屏手势模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Android 10中,用户可以启用全屏手势模式.我想检测设备是否处于全屏手势模式.我在文档中找不到任何内容.如何在运行时以编程方式做到这一点?

In Android 10, 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或kotlin语言的答案是可以的.

Java or kotlin language answer is OK.

任何官方API或解决方法...

Any official API or workaround...

推荐答案

您可以使用以下代码检查手势或导航模式

You can use below code to check gesture or navigation mode

    public static int isEdgeToEdgeEnabled(Context context) {
        Resources resources = context.getResources();
        int resourceId = resources.getIdentifier("config_navBarInteractionMode", "integer", "android");
        if (resourceId > 0) {
            return resources.getInteger(resourceId);
        }
        return 0;
    }

isEdgeToEdgeEnabled函数返回的值如下:

The value that returned by isEdgeToEdgeEnabled function will follow below:

  • 0:导航显示有3个按钮

  • 0 : Navigation is displaying with 3 buttons

1:使用2个按钮显示导航(Android P导航模式)

1 : Navigation is displaying with 2 button(Android P navigation mode)

2:全屏手势(Android Q上的手势)

2 : Full screen gesture(Gesture on android Q)

这篇关于如何在Android 10中检测全屏手势模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆