【发布时间】:2020-01-07 07:12:17
【问题描述】:
我将 setOnApplyWindowInsetsListener 设置为应用程序的根视图并获取导航栏更改的更新,但 insets.systemWindowInsetBottom 始终为 0
override fun onStart() {
super.onStart()
layoutMain?.setOnApplyWindowInsetsListener { v, insets ->
layoutMain.updatePadding(bottom = insets.systemWindowInsetBottom)
insets
}
}
layoutMain 是 MaincActivity 中的约束布局和根视图组
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/layoutMain"
android:fitsSystemWindows="true" ... >
在更多的事情上,我使用以下标志:
window.addFlags(FLAG_LAYOUT_NO_LIMITS)
[using following tutorial :] 也是我的另一个question for the same problem
【问题讨论】:
-
请尝试
onResume()或onCreate() -
无所谓-_-是回调
-
它与视图相关。并且您尝试从视图中获取回调。因此,在启动视图时尝试 onCreate 或 onResume :)
-
还是一样的结果
标签: android configuration navigation android-10.0