此检查无效

 fun showDialog() {
        if (supportFragmentManager.findFragmentByTag(FailureDialog.TAG) == null) {
            FailureDialog().show(supportFragmentManager, FailureDialog.TAG)
        }
    }

最佳答案

因此,该对话框被异步添加到片段管理器中,该检查不起作用,在这种情况下,值得使用 showNow()

fun showDialog() {
        if (supportFragmentManager.findFragmentByTag(FailureDialog.TAG) == null) {
            FailureDialog().showNow(supportFragmentManager, FailureDialog.TAG)
        }
    }

10-07 22:57