class SuperDuperDialog: DialogFragment{
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
WindowCompat.setDecorFitsSystemWindows(dialog!!.window!!, false)
ViewCompat.setOnApplyWindowInsetsListener(binding.root) { root, insets ->
doSomethingWithDialogMargins()
insets
}
}
它在 API <= 29 的设备上运行良好,但在 API>=30 上 setDecorFitsSystemWindows 被忽略。
有谁知道为什么?