任何人都可以在下面的代码片段中解释 A 和 B 之间的区别吗?它来自一个DialogFragment
.
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
// A) this works
binding = DialogFragmentPeriodPickerBinding.inflate(LayoutInflater.from(context))
// B) this doesn't work: no compiler error, but dialog won't show
binding = DialogFragmentPeriodPickerBinding.inflate(layoutInflater)
[..] // binding.root is later on passed to setView(binding.root) of MaterialAlertDialogBuilder
}