【问题标题】:Tell if Android P phone is using gestures or navigation bar判断 Android P 手机是否使用手势或导航栏
【发布时间】:2019-05-02 14:17:37
【问题描述】:

我的应用如何确定使用 Android 9 (P) 的用户使用的是经典导航栏还是类似 iOS 的新手势?

【问题讨论】:

    标签: android gesture navigationbar


    【解决方案1】:
    view.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
                @Override
                public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
                    Log.d(TAG, "onApplyWindowInsets: B"+ insets.getSystemWindowInsetBottom());
                    return insets.consumeSystemWindowInsets();
                }
            });
    

    我在片段的 onViewCreated 方法中声明了它。当导航模式改变时,insets.getSystemWindowInsetBottom() 返回不同的值。

    参考:https://developer.android.com/preview/features/gesturalnav

    【讨论】:

    • 这里的解决方案在哪里?谁能检查它是否是手势导航?为什么你需要一个视图呢?没有视图就无法检查?
    猜你喜欢
    • 1970-01-01
    • 2020-07-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-05
    • 2011-09-13
    相关资源
    最近更新 更多