我的应用程序如何确定使用Android 9(P)的用户是在使用经典导航栏还是在使用类似于iOS的新手势?
答案 0 :(得分:0)
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